09-29-2010 10:03 AM - edited 09-29-2010 10:04 AM
Hello,
I am using LabWindows/CVI 8.5, and I have a question about using tables.
The problem is this: In my table, I have 8 columns. I have columns of strings, integers, and a column of buttons -- so there is a button on each row. I have some information that is related to each row that I do NOT want to display in the table, however, I want this information to stay related to the other information on that row. Each row represents some high level fault information that is pulled from a log file -- when the user clicks on the button, I want to be able to go to the specified file and extract more detailed information about that fault and display it on another panel. The "hidden" information is (1) file ID number, and (2) seek-location value... i.e. 2 integers. My problem is how to have these 2 pieces of information available for each row, but have them be hidden from the user.
There are a couple of ways I can see doing this, but I am not really clear on how to do either.
(1) I could have each button also contain a string that includes the 2 pieces of info (e.g. "32:125567"), so that when I click on the button, the application can extract the string value from the button, parse it, and extract the two integer values... I actually have this working -- BUT the button actually displays the string containing the numbers! Is there a way to "hide" this information contained in the button?
(2) Alternative... Is there a way to include "hidden" columns in a table that can contain information -- but these columns are not displayed. For example, my table currently has 8 visible columns. Could I somehow add a column for file ID number, and a column for seek-location, and have these columns be hidden from view (but still accessible to the application)? I don't see a way to do this, but I am still very inexperienced using tables in L/CVI.
Or, you guys may know of a better way to do this...
Thanks much,
Harv
Solved! Go to Solution.
09-29-2010 11:07 AM
One major unknown feature of tables is that each cell can hold several data types at the same time.
In the online help you can read:
You can change the cell type to store all three types of values simultaneously in one cell, but only the value corresponding to the current cell type is visible and operable. For example, if you have a numeric cell with a value of 2.0 and you change that cell to be a string cell with a value of hello, when you change the cell back to a numeric cell, the value of the numeric cell remains 2.0.
That is, you can have a function that:
- Selects a numeric data type with SetTableCellAttribute (..., ..., ..., ATTR_CELL_TYPE, ...);
- Writes / reads numeric data
- Selects string data type
As far as you don't update the table between these operations the user won't see anything and your informations will remain hidden to him.
09-29-2010 11:11 AM
With reference to your question 2, even if it is probably overridden by my previous post, remember that a table can have more columns than those displayed on the screen.
You may configure your table to have 10 columns but only 8 shown ("size/scroll options" button in table properties in the UIR editor); since you may hide the horizontal scroll bar, even in this case you can store informations in the table that are not accessible to the user.
09-29-2010 11:29 AM
Another possibility would be to change the cell type for one of your integer columns to be a ring instead of a numeric. This would only work if you can make the cells in this column indicators (instead of 'Hot'). You could then add your additional two integers to this ring, but only display the third ring value - the value you intend the customer to see. When the button is clicked, you could retrieve the other two values with GetTableCellRingValueFromIndex.
I put together a really quick example of this and attached it.
NickB
National Instruments
09-29-2010 01:31 PM
There have been several good ideas here... I'm probably just going to add some additional columns to the table and not display them to the user. That seems to me to be the most straightforward thing to do. That way I can treat all the data in each row the same, whether visible or not.
I really like the idea of the ring though... that was pretty slick!
Thanks to all!
Harv