12-01-2014 12:34 PM
Is there a way to read a variable value from only knowing the label name? I have Labview 11 and am reading a text file with a list of variable labels and trying to read the value without having to create a case structure of hundreds of variables.
Solved! Go to Solution.
12-01-2014 01:14 PM
My first answer was going to be "No", but then I started to think about it. I'm assuming that the Variables are controls or indicators that are part of the VI or Project of interest. You could do the following (but it could get messy) --
Let me know if this works, and is worth the effort.
BS
12-01-2014 01:30 PM
In addition to what Bob Schor described it is important to note:
1. A variable in LabVIEW is the wire. A control or indicator is only used to get values from or display them to the user. Many variables are not connected to controls or indicators at all.
2. For Bob's method to work all controls must have unique names (labels). This is good practice anyway but is not mandatory. If you have five controls named "My Data", how would you know which one had the data you wanted?
Have you looked at the Configuration File VIs? They may be able to do much of what you want.
Lynn
12-01-2014 02:03 PM
Bob
I don't seem to have an AllVIs property.
Jack
12-01-2014 02:17 PM
Along with Bob and Lynn I offer the following example:
in the string you can ignore "Null, FormFeed, @, Newline"- just odd reprentations of size (0x000C) and unmasked Type Code (0x400A)
12-01-2014 02:31 PM - edited 12-01-2014 02:31 PM
Is this what we're wanting?
12-01-2014 02:33 PM
@JackTK wrote:
Is there a way to read a variable value from only knowing the label name? I have Labview 11 and am reading a text file with a list of variable labels and trying to read the value without having to create a case structure of hundreds of variables.
When you say variable do you mean a single process variable, a network shared variable, a Global Variable, or are do you mean indicators on a front panel of a vi?
I assume you mean indicators and the code listed in post above should get you started. If you mean another type of variable then there are other ways to go about it.
12-01-2014 03:28 PM
Thanks DailyDose
This solution will work great. I'm sure Bob was trying to get me to do this too.
Jack
12-01-2014 09:10 PM
Sorry, I was speaking "shorthand". If you drop a Property Node and don't wire it, it becomes an Application Property Node. One set of properties are the Application properties, and one of these is AllVIs. Here is 1000 words:
BS