LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I loop through the labels of a cluster as if they were enumerated?

Solved!
Go to solution

It is possible to loop through the labels of a cluster like this:

 

cluster question.png

 

However, this requires me to manually maintain the strings in the case structure.  

 

Is there a way to get those cluster labels into the case structure at design time, similar to using an enum?  They're right there!

0 Kudos
Message 1 of 4
(2,352 Views)
Solution
Accepted by jordanglassman

Unfortunately not.

 

You may want to think of using a different data structure.  If they are all the same data type, maybe an array would work better for you.

 

Another method would be to use Variant Attributes to hold the items in your cluster.  You can lookup items in a variant by name that way.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,338 Views)

I'll just use a typedef'ed enum and keep it in sync with the cluster labels by hand.

 

Would either of the other two solutions you mentioned would solve the labeling problem?  Can you retrieve the labels of an array of controls at design time?  Don't they all have to be the same, anyway?

0 Kudos
Message 3 of 4
(2,319 Views)

I really hate it when we say "You can't do that in LabVIEW"

 

The workaround is to not use the labels.  That's what Captions are for!

 

Gems1.png

 

(Those vis you don't recognize are from Darren's Hidden Gems package)


"Should be" isn't "Is" -Jay
Message 4 of 4
(2,313 Views)