LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Sub-VI's to simplify code: Locally packaged sub-vi's?

You can create an array of references.  However since all elements of the array must be of the same type, then the references might be cast to a more general class of a control.  So if you have a numeric digital control and a numeric knob, they might be cast to something more general.  If you build in a reference to a boolean control, now the array of references will be cast to an even more general class such as "Control".  The property nodes you can access based on that referenced will be limited to the properties that those types of controls have in common.  So you can access something like Visible? because all types of controls share that property, but can't access something like Display Format because that is specific to the digital numeric control.

0 Kudos
Message 11 of 12
(289 Views)

@Nukem wrote:

@RavensFan wrote:

You drop an array container on the front panel.  You drag and drop the resource name control into that.  You can expand the array to show more items at once on screen.


That is helpful, as is the idea to write the programs in such a way that a simple text file determines the specifics of execution. 

 

Is there a way to similarly combine references into an array? I am passing them through a cluster to send to my sub-VI, but the 10 different references have just become a wild mess on my block diagram. Making them an array or making them a cluster manually instead of with the build cluster command would clean up sections of my code significantly. 

 

My end goal is to disable and gray out all but 3 items from my front panel while my program is collecting data. I can still pause, resume, stop, and change one parameter, but the rest are disabled. So I am left with a slew of references that I pass through a cluster to a loop. 


References can easily be grouped with Build array, which will typecast them to general references and you might need to convert them to access specific properties.

I'd make a type def'd cluster of references and gather all in an Init state, you can then use Unbundle by name to get the reference in a nice manner.

 

However, it's rarely you should need to use the references is my experience, it's the data that should be clustered up and handled in the sub-vi's.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 12 of 12
(276 Views)