LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write table with row and header information to database

I am able to write 2D arrays to a database. I would like to write the front panel table's row and header information along with the data as well.

Is there a way to do that? I couldn't find any in the examples.

NI System Configuration:
- NI PXIe-1071, 4-Slot 3U PXI Express Chassis , 1 GB/Slot throughput, Part Number: 781368-01
- NI PXIe-PCIe8381,x8 Gen2 MXI-Express for PXI Express Interface,3m, Part Number: 782522-01
- PXIe-5160 PXI Oscilloscope, 500 MHz, 10 bits, 2.5 GS/s, 2 Channels, 64 MB, Part Number: 782621-01
- Astronics PXIe-1209 2-Channel, 100 MHz PXI Pulse Generator, Part Number: 785033-01
0 Kudos
Message 1 of 5
(2,681 Views)

@asukumari wrote:

Is there a way to do that?


There are hundreds of ways to do that.

 

If you can write 2D data to a database, can't you make the row and header data 2D and write it in a similar fashion Smiley LOL?

 

What database are you using, what DB library are you using? What does your code look like? Is the 2D data concatenated? Sometimes people things it's OK to create a new table for each measurement, is that the case? What does the database look like? And so on, and so on...

0 Kudos
Message 2 of 5
(2,606 Views)

Well I don't store my data in a database but In general here is what I do.

 

I like state machines so I will have an "Open File" state that does these things 

 

  1. Open a data file
  2. Write the header strings to the file
  3. Pass the file reference into the state machine using shift registers

In my "Save Data" state I use the file reference to write the numeric data to the file a line at a time 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(2,587 Views)

Of course I can write the row and column header as a 2D to the database table. I would like the row-column header along with the data in the test_csv_information column.

LabVIEW_2019-07-19_11-21-55.png

Attached VI shows how I upload a sample 2D data to the DB. However, the table (as shown below which is a front panel indicator) has column and row headers, is there anyway I can send the table data along with its column and row headers directly as a 2D array to the database?

NZuaJKg

 

Its a Microsoft SQL DB, No I use the same table for every measurement differentiated by the first column : TimeStamp value.

 

NI System Configuration:
- NI PXIe-1071, 4-Slot 3U PXI Express Chassis , 1 GB/Slot throughput, Part Number: 781368-01
- NI PXIe-PCIe8381,x8 Gen2 MXI-Express for PXI Express Interface,3m, Part Number: 782522-01
- PXIe-5160 PXI Oscilloscope, 500 MHz, 10 bits, 2.5 GS/s, 2 Channels, 64 MB, Part Number: 782621-01
- Astronics PXIe-1209 2-Channel, 100 MHz PXI Pulse Generator, Part Number: 785033-01
0 Kudos
Message 4 of 5
(2,570 Views)

I don't have LabVIEW installed at the moment (new computer... long story) 

 

Well you can only write one data type at a time.

 

You are going to have to break this up into several writes.

 

Or convert everything to a string array to write it all at once.  

 

Frankly I do not like writing all my data in one shot at the end of a program or test. Because if the program crashes or fails for some other reason before the test is completed. I would rather have partial data than no data at all. So I save my data a line at a time as soon as possible after the data is taken

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(2,563 Views)