LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How Do I Access VI Server Information on arrays of clusters

I have an array of unknown size where each element is a cluster. I need to generate a reference number for each element using the application control tools so I can look at properties of the cluster. When I look at the array properties of NumCols and NumRows the value I get are only for the size of the array on the front panel and not the actual number of rows and columns in the array. How do I get a control reference for each element in an n dimensional array?
0 Kudos
Message 1 of 7
(3,183 Views)
There is no point in getting a reference to each array element because they all have the same properties. The last option in the array properties list is array element, which will give you access to the properties of all the elements. You can use to more specific class to get the specific properties available for that element.

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,178 Views)
Thank you for your quick reply Proven Active Veteran. The Value property returns just a single variant value. But when I flattened the variant to a string with Flatten Variant to String.vi, the string appeared to contain the information from all elements in the array. I'm just not sure how to proceed from here. It seems like converting the variant to an array of the original type is what's needed in order to get information on each control for each element, but simply wiring the TypeDesc property to Variant to Data.vi results in an error and the array data type varies depending on which array the application is reading so I cannot hard code the data type.

For further explaination : I intend to programmatically change all text values - captions, descriptions, tipstrips, and contents of each control based on an end-user selection so I do need to be able to read and write the properties for each element in an array.

Any further suggestions?
0 Kudos
Message 3 of 7
(3,172 Views)
There are 2 things here, which need to be understood:
1. The only thing in which array elements can differ is their value. Everything else (data type, caption, size and so on) is identical to all elements in the array. If you change it for one of them, it will change for all of them.
2. A control's value and a control's reference are 2 different things. The reference is used to talk about the control itself, where the value is the actual data the control holds.

If you want to get the array's value, the simplest way would be to take a wire from its terminal. If that's not possible, you can use a local a global variable. The least desirable way is to use the value property, but if you want to, you need to convert the variant. To do this, use Variant to Data. You need to wire the data type (like 2D DBL array) into the Type input - just wire an empty copy of your array in there.

You should think about how much you need to change the properties - if you really need to have different properties for each element, you can either use seperate clusters (not in an array), or have the captions as string indicators inside the cluster - you can then change the value of the string indicator by wiring a different name into it.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(3,168 Views)
Thank you again for your quick reply. I do understand that the control properties (data type,label,caption,...) are identical for each element in an array. The issue is that I need the element value for any string in any array. I cannot use a global variable or wire to the actual array to obtain the string or to define the variant datatype as I do not know which arrays will be going through the code ahead of time. I have attached a small sample code that perhaps explains the issue better.
0 Kudos
Message 5 of 7
(3,160 Views)
I'm not exactly positive of what your ultimate goal here is, so I really want to clear that up. As I understand it, you are trying to access the value of each element in some arrays without knowing ahead of time what arrays are going to be available? One thing I want to point out is that each element of an array will not have it's own reference, only the array as a whole can have it's own reference.

One thing you might want to try, if I am understanding what you want to do, is to use an invoke node with the method "Get Control Value" or "Get All Control Values". Then you can parse this information to get what you need.

TylerS
0 Kudos
Message 6 of 7
(3,148 Views)
I can't look at your VI at the moment, but I would like to point out something:
If I understand correctly, you want to be able to handle arrays of different sizes and of different kinds without knowing what they are in advance. This is quite simply impossible for 2 reasons: 1. A wire can only have one data type (e.g. 2D DBL Array) and the array functions are polymorphic - If you wire a 1D or 2D array into them, they will change.

What you may want to look into is using a polymorphic SubVI. You will need to write a code for every possible case, and the appropiate VI will be selected according to the input. However, you should still keep in mind that a specific wire can only have one data type and this has to be set when you write the code.

___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(3,142 Views)