To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example demonstrates how to set the visibility of each element in the cluster so that the number of elements displayed matches the number of items in the original array
Description
Here is a brief description of the example:
With the Array to Cluster function, it is possible to convert an array of data to a cluster of those same elements. Unlike the array, the cluster has a fixed size configured through the right-click menu of the Array to Cluster function. Thus, if the array size is not known at run-time, the cluster may display too many or too few elements.
This VI sets the visibility of each element in the cluster so that the number of elements displayed matches the number of items in the original array.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
The example gives a nice solution to the difficult problems that can be encountered when writing a semi-scalable user interface.
For example, when you want to create a list of items with select boxes, but sometimes not have them be selectable by users (because they are N/A -- meaning not applicable or not available).
One example of this would be if you want to notify a list of users by email of an event. Let's say this list is built dynamically by reading in an external file, so using an array is good for the unknown & possibly changing size of this list. However, another aspect of this list is that some users do not have a secondary email.
Using an array initially seems like a nice way to couple user names and primary + secondary email Y/N selection buttons. However, if the user doesn't have a secondary email listed, no selection should be enabled for it.
This can't be done on a per-user basis using an array; properties for the controls that are within clusters (the array element is a cluster) apply to every element of they array.
If a cluster of clusters is used instead of any array of clusters, it can be made to look like an array and even "act like" an array; after all, an array has a finite display size. The cluster can be made to look/work very much like an array, with a numeric control that looks like and works like the array index, but in this case it will be a cluster display start index. (Similar to the example, I wired the result of an "in range?" boolean to the Visible property node. I've tried it out & it works fine.)
The screen shot (VI Snippet) should not be saved, as it does not work. It really should be updated. The attached VIs do work correctly.