LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

naming and getting names of the cluster elements

1) How can I give to the elements of a cluster, specific names?
Of course, I can use "bundle by name" and a cluster of constants having the names I intend to use but this is not what I mean. For example, let's say I have 20 property nodes linked to 20 controls which are not members of a cluster (or are not members of the same cluster) and I need the property "visible" (or "disable" etc). Now let's say I want to bring them together in a cluster. The problem is that all the cluster elements are now called "visible" (or "disable" etc) and what I want is to give them the names of the corresponding controls. More than this, I want that, when I change the name of a specific control, the name of the element of the cluster to be changed accordingly.

2) Conversely, how can I get the name of an element of a cluster?
I can use "unbundle by name" to select it, but this will give the value of its data, whatever it is. The question is, how can I get it's name?

3) This is, somehow, a combination of the previous two. Sometimes is more convenient to use arrays to process data, instead of clusters. But using "cluster to array" and then "array to cluster" the names are lost, again. I could use "unbundle by name" (before array processing) and then "bundle by name" (after array processing) and connect element by element, but in case of big clusters this is very much space consuming. What else could I use?

4a) More than this, how can I concatenate two clusters?

4b) How can I set (not manually) the size of "array to cluster"?

Thanks a lot,
Silviu

0 Kudos
Message 1 of 18
(9,689 Views)

Hi Silviu,

You can use the Controls[] property of a Cluster control/indicator to set/get the names of the controls/indicators in it.

This will give you an array of references to the controls/indicators present in the Cluster. You have to use Index Array function or the For loop to auto-index the controls/indicators present in a Cluster to set/get the desired properties of those elements in the Cluster.

Moreover, you can index this Controls[] references & use the Class ID to find what type of control/indicator it is & set/get its properties accordingly.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 2 of 18
(9,687 Views)
Hi Silviu,
how do you build clusters? Smiley Happy The name of the element which you insert into a cluster is the name you see if you use bundle or unbundle by name!
 
to 4a) unbundle them and concatenate the parts you want.
to 4b) afaik this is not possible, and if you think about it, it is not useful, because what do you try to do with a cluster from which you don´t know the size or the elements in it?
 
Can you explain what you want to do?
 
Mike
0 Kudos
Message 3 of 18
(9,687 Views)

Hi Silviu,

Bundle by Name & Unbundle by Name will give only the values of the elements inside a Cluster, not their names [label/caption].

It is better & easier to play with the Caption names in run-time, because Label names are fixed thro' out your program, both at design time & run-time. The ability to write to the property, label.text programmatically may confuse a bit, but it will throw an error while running, saying that the Label name of a control/indicator cannot be changed at run-time.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 4 of 18
(9,684 Views)
As I said, the elements of the cluster I talk about are not members of a cluster existing on the front panel. They are simply 20 signals grouped together in a cluster. They come from 20 property nodes and they are all named (in the created cluster) "visible". So, how can I use in this case the property "controls"?
0 Kudos
Message 5 of 18
(9,678 Views)

Hi psilviu.

why don´t you tell us the purpose of this. May be there is another solution. Smiley Wink What type have your 20 signals, have they all the same type?

Mike

0 Kudos
Message 6 of 18
(9,676 Views)
4a) I have two clusters: one of 20 elements, one of 5. I want to obtain one single cluster of 25 elements without losing names. (build cluster will make a cluster of two clusters)
4b) I can use "array size" to determine the size.
0 Kudos
Message 7 of 18
(9,673 Views)
MikeS81

I want to determine and set the "visibility" and "disable" properties for a bunch of controls and indicators of different types. They are not members of the same cluster. I use property "visibility" (and / or "disable") to obtain this information. The problem is that I want to process all this together using loops etc. so I built with them a cluster but all this "wires" don't have the name of the corresponding controls.

The truth is that is not the first time I look for solutions for the questions I posted but today I decided to ask them all. So the answers are not for my current development, only. I decided today to ask for help on this forum.

Silviu

0 Kudos
Message 8 of 18
(9,667 Views)
You're misusing clusters. A cluster is a closed group where each element has a specific meaning. It sounds to me like you actually want an array of references. This example might do what you want. If it doesn't, I suggest you start from scratch and explain what your end goal is.

___________________
Try to take over the world!
0 Kudos
Message 9 of 18
(9,666 Views)


psilviu wrote:
As I said, the elements of the cluster I talk about are not members of a cluster existing on the front panel. They are simply 20 signals grouped together in a cluster. They come from 20 property nodes and they are all named (in the created cluster) "visible". So, how can I use in this case the property "controls"?



Just create a Cluster indicator by rt-clicking on the grouped 20 signals [using Bundle by Name node I suppose] wire & use its Controls[] property from now on everywhere in your code. Smiley Happy
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 10 of 18
(9,654 Views)