LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
AndyRR

Unbundle cluster reference

Status: New

It is possible to trigger an event by a button inside a cluster (LV 2010 at least). However it seems that it is impossible to refer to a button inside a cluster with a reference. One possibility to do that easily would be to unbundle a cluster reference. My suggestion and current situation below:

Unbundle cluster reference suggestion.png

Unbundle cluster reference current situation.png

18 Comments
Knight of NI

Actually, your current situation is incorrect, since you can create a reference directly from the individual Boolean controls to allow you to do the comparison. That said, in terms of getting the references, are you referring to a special "Unbundle" operation? Currently the "Controls[]" property will return all of the controls (as references) inside the cluster. The limitation is that you have to index them out by number rather than by name.

AristosQueue (NI)
NI Employee (retired)

That use of the Unbundle node strikes me as really weird. Would you make Index Array on an array control refnum return the contained element (and presumably disallow wiring the index terminal since it's the same element control no matter what).

 

But smercurio_fc is right... the solution today is to create a reference specifically to the boolean directly or use the Property node for access to the inner controls.

AndyRR
Member
Maybe I was a bit too fast to suggest this idea. I should first have posted this as a question instead. I tried the currently available solution and it works fine, thanks! However I think it could be useful if you could access inner controls by name too. That could make it easier for a Labview programmer to figure it out for the first time. My suggestion above is not the best solution after all, as Aristos Queue pointed out.
Timmar
Active Participant

I am frustrated by the current "Workaround" it is bad practice to have to know the index of the control if you re-order them the code breaks. You don't get a (Strict) datatype with it either.

I like andy's suggestion, it has a lot going for it.  If it is an array reference, allow index array instead of unbundle.

I wanted a function like this on day 2 of my labview adventure.  I wanted an array of round LED's and to be able to discreetly choose which one was blinking and it's colour.

That was 6 years ago!

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
NI-hilator
Member

I agree with Timmar that the current "workaround" is not very elegant.  AndyRR's suggestion having the ability to unbundle with a reference as the output would be immensely useful and more robust.  In fact I was going to submit a similar idea until I searched and found Andy's post.  This would also be useful when passing clusters or typedefs to sub vis that need to access the properties of one of the internal controls.

jsimbul
Member

Does AndyRR suggestion already implemented in LabVIEW? I think this is very useful in unbundling all members of the cluster reference instead of using the for loop or indexing to access a control.

tst
Knight of NI Knight of NI
Knight of NI

As said, you can create static reference directly to members of the cluster - just right click any control inside the cluster and select Create>>Reference.


___________________
Try to take over the world!
astrix
Member

I'm in agreement here. This has been really annoying me the last couple of days. I've been hunting for a way to get the references to controls within a cluster by name, instead of having to index the Controls[] array. Is there any reason why this shouldn't be possible?

Intaris
Proven Zealot

It IS possible.

 

You can (if you want) write your own code to get the reference by name by parsing the "Controls[]" property of the parent cluster.  There's absolutely nothing stopping you from doing that.

 

I don't see the need for LV to change in this case.

 

Lets say, for arguments sake, NI introduced a new property for clusters which returned the strictly-typed references for the items within.  This would of course mean that the cluster reference being passed into that property node would also have to be strictly typed (otherwise the IDE can't know which references to return).  This then very quickly prohibits you from creating a sub-vi for this general purpose as two different clusters with different datatypes will not wire up to the same strictly typed input.  I certainly don't see this as being more robust.  I also don't think it'd be very useful once you've encountered this problem a few times.  And yes, AFAIK the name of the controls is part of the data that gets passed by a strict refnum.

 

PS I'm not against the idea per-se.  I don't think it's going to deliver the benefits some think if you consider the side-effects such a change would carry with it.

1984
Active Participant

We should have such thing. If I pass a reference of a cluster to a subVI then how on earth can I access the properties of the controls in the cluster? By their order in the cluster? That can change anytime. By their name? That can change anytime as well. These solutions are crap.

 

The reference of the cluster must have all the information to controls in the cluster as well otherwise how could we change the value of the cluster? I could miss something here, but  what is the problem with simply "unbundling" the ref of the cluster to the ref of the individual controls.

 

Passing the references of the individual controls is NOT a good solution as a given cluster can have dozens of elements.