LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get a cluster element value from a variant

Solved!
Go to solution

What function do you use to display that rectangle on the right with all the values?

0 Kudos
Message 11 of 16
(2,098 Views)

Not a "function", but you can right click a variant indicator and toggle settings to view the type, and/or view the data.

 

That said, you never would use the variant indicator for a user-facing front panel - by its nature it's totally generic and ugly. Instead, on the block diagram use the "Variant to Data" primitive (or if you need to do more dynamic interpretation of the type, appropriate VIs referenced earlier in this thread - OpenG Variant Tools or NI's VariantInfo VIs).  Once the variant is converted to a native type, you have available all the customizable controls/indicators.

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
0 Kudos
Message 12 of 16
(2,091 Views)

The code is much simpler if the cluster is in a control or indicator instead of a constant. In that case, just create a Controls[] property node from it then connect its refnum elements to a Value property node which you can wire to Get Type Information.vi to select your type case.

0 Kudos
Message 13 of 16
(1,815 Views)

The simplest (and, I think, fastest) code to get the elements of a cluster (including data) is this:

original.png

See also this idea.

Message 14 of 16
(1,809 Views)

I am a few years late, but you can just use a variant to data instead of flattening and unflattening.

cluster elements variant.png

I am using LV2010, so I used the old GetClusterInfo, but the problem is the same. Just to know, the block diagram is still password protected? If not, could someone provide it to me? I'd like to correct the VI myself, but my version of it is password protected

Message 15 of 16
(1,743 Views)

Hi Daniele88,

 

The block diagram is still password protected.

 

In the future, I would also suggest creating a new forum post so you get more visibility and more responses.

Melanie P.
Technical Support Engineer
National Instruments
0 Kudos
Message 16 of 16
(1,720 Views)