Example Code

Accessing Properties of Cluster Elements within an Array of Clusters

Code and Documents



This example VI shows how to access and modify the properties of individual elements within a cluster, which is in an array of clusters.

For users that wish to programmatically set the properties of elements within a cluster, which is within an array, the method of accessing these properties may not be obvious.  The reason that one may desire to do this programmatically is to ensure the aesthetics of the front panel remain constant during operation, or to allow customization of various properties of nested elements.

VI Server References are used to narrow down the selection in the hierarchy of the nested elements.  In this example, we are wanting to modify the properties of the string controls of a cluster, which is within an array.  Therefore, we need to first use a reference to the array in conjunction with a Property Node to access the element.

Once we have gone down a level in the hierarchy, we will then need to use the next server reference, in this case the cluster, to go to a more specific class.  Once this is done, we can access the properties of the cluster itself.  However, we are not quite done here, because we are targeting the elements of the cluster.

Because clusters can have multiple element types, we need to access each element by its order of placement, and then by using a Refnum for the specific element we can target that specific class.  Once we have reached our final destination of the hierarchy, one can access the properties and set values with a standard Property Node.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.