LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I reference the properties of a control in a cluster in an array of clusters?

Solved!
Go to solution

Hello

 

I am a Labview newbie, so any advice is welcome on any of the code posted here. 

 

I have a test VI where the operator is required to "tick" boxes which are then "signed". Once all the boxes are signed correctly, the operator indicates that they are finished entering data and the VI requests that an "authoriser" ticks the same boxes as the operator, again being "signed". I created a "list item" control which contains a cluster of a string for the check list item description, a Boolean control and string for the operator "tick" and "signature" and a Boolean control and string for the authoriser "tick" and signature. This control is then initialised into an array to create however many checks are required (currently 10), making an array of clusters. See the jpg for the front panel to make this clear.

 

In the list item cluster control I want to have the authoriser "tick" box and "signature" remain disabled and greyed out until the authoriser is validated (currently a barcode scan), at which point I want to enable these boxes for the authoriser input. I am having trouble referencing the two controls in the list item cluster control in order to be able to change their disabled property. I do not want to implicitly reference the control. I seem to be able to access the array element (i.e. one list item control) by reference, but not the controls in this list item cluster, this code is shown in "Reference to cluster in an array.jpg".

 

I have being going round in circles for a while now, so any help would be much appreciated.

 

Regards

 

Ray

0 Kudos
Message 1 of 12
(3,565 Views)

The problem you are going to have is the array. The issue is that the only thing different between elements in an array is the data values they contain. The properties are in common for all the elements. Hence if you disable a button, the button will be disabled in all the elements.

 

In the past I have dealt with this issue was to create a scrolling list consisting on a cluster containing several identical subclusters. I would then manipulate the data contained in the subclusters such that it would appear that the list was scrolling up and down. With that setup I was able to modify the properties of each subcluster property individually.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 12
(3,550 Views)

Thanks for the reply Mike.

 

I think I understand what you are saying - that if I enable a boolean control in the cluster, this will enable the boolean control in each element in my array. This would actually be OK, as I would like to enable all the authoriser "tick" boxes and the "signature" boxes in the whole array at once.

 

Currently I am unable to reference the properties of the boolean in the cluster (in the element of the array, although if I understand you correctly the element does not matter) so I cannot enable the control. Is this something you did in your example below?

 

Thanks

 

Ray

0 Kudos
Message 3 of 12
(3,545 Views)
Solution
Accepted by topic author Radiator

There are two ways to get a reference to an item in a cluster, in an array. The first way it to start with a reference to the entire array and deconstruct it. That is a pain. The easy way is to right click on the item in the cluster and under the Create submenu select Reference. LV will switch to the block diagram and you will notice that the cursor will be holding a reference to the thing you clicked on. The third way to go ("...nobody expects the Spanish Inquisition...") is in the Create submenu select Property Node and then select the property you want.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 12
(3,537 Views)

It can be as easy as ...

 

Go to the FP, right click the boolean in question (just the boolean not the cluster) and select "Create property node".

 

If you want to do this from a sub-VI then you can review This Nugget where I discuss the challenges of naviagting through clutsers and arrays. You don't have to read the whole thing. Stop after you get to the info you need now.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 12
(3,535 Views)

If you want to put your property manipulation code in a subVI you can also create it using the property nodes you created like Ben and I explained, select them and from the Edit menu select Create SubVI. LV will automatically bundle the code you had selected into a subVI and generate the necessary references.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 6 of 12
(3,531 Views)

Mike, Ben,

 

Thanks - the implict reference was the way forward. Annoyingly this is what I tried first but I must have cooked the code as I failed to get the same result. The implicit reference for a control in one cluster in the array controls the property for all the array elements.

 

BTW the nugget is very useful information!

 

Thanks again,

 

Ray

 

0 Kudos
Message 7 of 12
(3,517 Views)

@Tarsel wrote:

Mike, Ben,

 

Thanks - the implict reference was the way forward. Annoyingly this is what I tried first but I must have cooked the code as I failed to get the same result. ...Thanks again,

 

Ray

 


 

Most of the time, the answers we need in our code is hiding bhind a right-click option. The above scenario is one of the rare cases where a code solution start of the FP.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 12
(3,491 Views)

Too old

Message 9 of 12
(3,490 Views)

@dkfire wrote:

Too old


 

And I was just getting started, oh well! Smiley Wink

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 12
(3,484 Views)