From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting element labels from a cluster

Solved!
Go to solution

I need to programmatically get the labels from the elements in a cluster. I've figured out how to get them one at a time using property nodes (see below) but since there are quite a few elements in the cluster this would get rather bulky not to mention tedious. Does anyone know of a better way to do this?

 

Thanks

Capture.PNG

0 Kudos
Message 1 of 6
(5,734 Views)
Solution
Accepted by topic author GDthomas

Hi rtpumps,

 

using a property node of the cluster you get the "Elements[]" reference array.

Then read the "Label.Text" property for each element:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(5,729 Views)

Hi GerdW,

We must have different versions of LV because there is no Elements[] in the property node but one called Controls[] that does the same thing. It's just what I needed.  Thanks!

0 Kudos
Message 3 of 6
(5,715 Views)

Gerd is German, so his properties probably have different names.  You can see that one property is "Beshcr" .text

0 Kudos
Message 4 of 6
(5,669 Views)

A better solution is Get Cluster Information and Get Type Information from the Programming -> Cluster, Class & Variant -> Variant -> Data Type Parsing palette, as shown below. Before LabVIEW 2015 or so, similar functions were available in vi.lib\Utility\VariantDataType, but those are now deprecated in favor of the newer versions on the palette. One major advantage of this approach is that it works in executables on RT targets, whereas the property node approach will not.

Get Cluster Element Names.png

 

Message 5 of 6
(5,658 Views)

Hi,

 

yes, I'm using (or: have to use) a German LabVIEW version.

"Beschr" is the abbrevation of "Beschriftung", the German translation of "label". "Caption" would be "Untertitel"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(5,654 Views)