LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying JSON data (Array of Clusters issue....)

That's interesting, I will have a play with that, as you say its got nested clusters etc, I guess I would need to get the indexes for each "control" type then process each type in a separate case with for loop inside or something, I'm sure I came across an example doing something similar

 

As this is the only part of the code that updates the data within the individual camera clusters, would you pass a subvi a reference to a mainvi front panel control, or pass out a reference to a front panel control that is within the subvi? I presume one of the other is "best practice"....

0 Kudos
Message 11 of 12
(327 Views)

I use the following to get all of the references from the Front Panel, 2018 Version attached. Documentation below.

 

SubVI returns an array of Control References, and Control labels of the controls and indicators on the front panel of the Main VI. This includes clusters, arrays, tabs, and the elements contained in each. It also returns a VI and Panel Reference that refer to the Main VI.

Use Unique labels for each control. Use captions if you want items to have the same name.

The references returned are generic and need to be changed to a more specific class if certain properties are needed.

VIRef - Returns a static VI reference to the Main VI. You can use this reference to access the properties and methods for the associated VI.
PanelRef - Reference to the front panel of the Main VI. You can use this reference to access the properties and methods for the associated Panel.
ControlNameArray - An array of control and indicator names on the front panel. This includes elements in clusters, arrays, and tabs.
ControlReferenceArray - An array of control and indicator references on the front panel. This includes elements in clusters, arrays, and tabs.
Error In- Standard Error In
Error Out - Standard Error Out

 

Now you have two arrays, one of references, one of names that you can use to "filter" out the references you want. Pass through references to subVIs to change properties. A map is probably better than a pair of arrays, but it wasn't around at the time I wrote this.

 

mcduff

 

EDIT: This VI should be placed somewhere on the block diagram of your Main VI. It can be in another subVI, the Call Chain will get the highest calling VI.

 

snip.png

 

0 Kudos
Message 12 of 12
(321 Views)