LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read value from variant of cluster

Solved!
Go to solution

Hello everybody,

my simplified scenario is this: I have N clusters, C1, C2, ... CN. They are different but all of them contain a double named D. I want to design a VI that takes in any of those clusters (cluster->variant first) and returns D. I tried to use the Get Variant Attribute with 'D' as name input, but that doesn't work. How can I achieve my goal?

0 Kudos
Message 1 of 7
(6,715 Views)
Solution
Accepted by topic author m-ad

HI m-ad,

 

There is a VI call Get Cluster Element by Name_ogtk.vi ib openg toolkit package which do that!

 

You can find the package on VIPM.

 

I made you a screenshot.m-ad.PNG

 

Regards

Sabri JATLAOUI - Certified LabVIEW Architect - Certified LabVIEW Developer
Message 2 of 7
(6,711 Views)

If you don't want to use toolkits, here is how you do it with primatives..

 

ClusterSnippet.png

CLD | CTD
Message 3 of 7
(6,686 Views)

Better yet, here is the snippet, use this..

 

If you only care about your "D" label, then just code up the "D" selection in the case structure..ClusterExample2.png

CLD | CTD
Message 4 of 7
(6,683 Views)

Where the reference is to "Cluster 2" is wrong.. I don't know why the snippet keeps creating that, replace it with a Reference to the Cluster control, then it will work

CLD | CTD
0 Kudos
Message 5 of 7
(6,678 Views)

LabVIEW's built-in VI snippets always breaks references and event structures.

 

Use the Code Capture Tool and you won't have that problem.

 

0 Kudos
Message 6 of 7
(6,664 Views)

While the marked solution (to use the excellent OpenG toolkit) is clearly my first choice, since someone else spoke about avoiding toolkits, I'll mention that more variant support is built in to the native LabVIEW distribution.  You can also find a solution in the VIs under: <vi.lib>\Utility\Data Type, starting with "Get Cluster Information.vi".

 

And I'd say that the suggestions involving references to controls, and property nodes, are no solutions at all.  None of what you're asking for needs to work with front panel references.

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 7 of 7
(6,531 Views)