LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the reference of an array element?

I have a reference to an array of clusters. The cluster is a strict type definition. The array may contain any number of elements. If I take the property node value Array Element->Reference, I always get the reference of the last element in the array but I need to access the reference of each and every element in the array. How do we do this?

I found out a circuitous way to do this but it wouldnt work if the cluster were a strict type definition. I had to change it to a normal (non-strict) type definition. This involved assigning a value to the property IndexVals. If I assign the value n to the first element of this property (this property requires an array input) and then take the property node value Array Element->Reference we can get the reference of the nth element. But this method will not work if the cluster has to be a strict type definition.

I am eager to know if there is a way to do for strict type definitions. Please let me know.

Thanks
Partha
0 Kudos
Message 1 of 3
(3,183 Views)
Interesting observation. I don't know why the behavior differs for strict typedefs.

Let me ask a more basic question: what are you trying to accomplish, i.e. why do you need references to individual array elements? These elements will all be identical to each other, except for the values of their data, which you can obtain using normal array indexing and unbundling.

Steven H.
0 Kudos
Message 2 of 3
(3,176 Views)
Actually i am trying to get the VI to work for any array, meaning the VI should work irrespective of the cluster that is present inside the array. The VI should return the label and value(as a string) of all elements in the cluster.

I have now identified the problem. It was my oversight. The array in itself is an element of another strict type definition. Since we cannot set the property of an element of a strict type definition I got the errors. I misinterpreted this error and thought the error is occurring because of the type of the cluster (strict/non-strict) within the array.

Thanks for replying
Partha
0 Kudos
Message 3 of 3
(3,166 Views)