LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I display data from a query in a table?

I am using the Fetch Recordset Data VI.  From this I want to display the data in a table.  How do I convert the 2D array of database variants to a 2D array of strings to be displayed in a table?  I am using LabVIEW 8.0 developer suite with the database connectivity add on toolkit.
0 Kudos
Message 1 of 11
(5,159 Views)
Wire the array into 2 nested for loops. It should auto index.
Place a DB Variant to Data function inside the inner loop and convert the variant to a string.
Wire the result out of the loops and it should automatically build a 2D string array, which can be wired into the table terminal.

___________________
Try to take over the world!
Message 2 of 11
(5,151 Views)

Thanks.  That works great!  How do I display the database column names in the table.

0 Kudos
Message 3 of 11
(5,147 Views)
I figured it out.  Here is how I added the column names..  II wired the DB Tools List Columns VI and the output of the nested for loop to a build array.  Then the output of the build array is wired to the indicator table.
0 Kudos
Message 4 of 11
(5,140 Views)
As another options, tables (unlike arrays) have column and row headers (index -1) which can be accessed through a property node. If you create a property node for the table you can select the Column Headers[] (or rows) property which is a 1D array of strings.

___________________
Try to take over the world!
Message 5 of 11
(5,137 Views)
Thanks.  I was able to set the column names with the property node VI by setting the "Column Header Strings[]" table property.  Just a note... You have to set the table property "Visible Items: Column Headers Visible" to true to see the columns. 
Message 6 of 11
(5,126 Views)


@JennS wrote:
Just a note... You have to set the table property "Visible Items: Column Headers Visible" to true to see the columns. 

Which you can also do by right clicking the table and checking the headers in the Visible Items submenu. Smiley Happy

___________________
Try to take over the world!
Message 7 of 11
(5,106 Views)

Yeah, I noticed that after I posted the last message.  I have only been using labview for a week now.  I am a test engineer and all of the applications I write have been in C++ Builder.  We are wanting to use LabVIEW hoping that it will speed up our software development time.  So far I like it.  It's a matter of becoming familiar with the functions and getting use to a different programming style.

Thanks for your help!

0 Kudos
Message 8 of 11
(5,100 Views)
Hello,
 
I have a post up individually but could not help reading some of the things you were able to do with your vi.
 
May I ask for your suggestion:
 
How do I show my columns (appear in Front Panel), from the vi that I have attached.
 
Everything works fine but I can not show the actual data in front panel.
0 Kudos
Message 9 of 11
(5,094 Views)
Here is the VI I wrote to display the data from a select query in a table.  It also shows the columns.  I think if you wire your nested for loop to your table indicator it should work.  Hope this helps.
0 Kudos
Message 10 of 11
(5,083 Views)