LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting columns and extracting information from Tables

Hello everyone, 

 

I am currently working on a project that involves reading information from a csv file, parsing it, and then displaying the information in a table. I have been able to complete all of that, but am a little stuck on the next step. 

 

My goal is to allow a user to select specific column headers, and then have the information from that column stored in an array so I can perform calculations on the information. 

 

Can anyone steer me in the proper direction on how to properly complete this task?

 

Thank you very much!

 

 

0 Kudos
Message 1 of 4
(2,529 Views)

You can install a callback on the table and trap EVENT_TABLE_ROW_COL_LABEL_CLICK event in that, next check eventData2 parameter that holds the column clicked (it is 0 if the user clicked a row header) and use GetTableCellRangeVals (panelHandle, PANEL_TABLE, VAL_TABLE_COLUMN_RANGE (eventData2), array); to get your data.

'array' must be an array of the correct data type and enough lenght to read the whole column.

VAL_TABLE_COLUMN_RANGE is a handy macro defined in userint.h, a file where you can find others as well.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(2,482 Views)

Thanks Roberto, that seems to be the way to do it!

 

Do you know if it is possible to change the table label so that it contains the first row of my data?

 

Thanks a lot for the help, I really appreciate it!

0 Kudos
Message 3 of 4
(2,476 Views)

I suggest you to look at the table control help (which you can reach in your PC by right clicking on the control and selecting "Control help" in the context menu): by looking at the control functions you'll find SetTableColumnAttribute which you can use to change the column header by using ATTR_LABEL_TEXT attribute.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 4
(2,471 Views)