LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

select property of a variable


I have 50 different bool variables (indicator LEDs) & depending on the situation I want to change the property of one of the variables.
Is there any way to select programmatically to select the which property of the variable I am going to change.

I dont want to make 50 different property nodes for each variable.
I want to have one property node and depending on the situation I want to assign that property node for one of the variables.

I have to do this because, I have to change the property of the LEDs in so many  times in the program in different postitions.
50 property nodes will make it hard to see the program.

Pls help in this matter.

Naushica
0 Kudos
Message 1 of 18
(6,243 Views)
 I would like to cklear little bit more about the question.

I have 50 LED indiactors named LED0 to LED49. depending on the situation, I may need to access property of LED0.
In another situation LED 10, or LED 25. so on. But I will be accessing the same property of all variables. (e.g. color)
I want to know how to do this.

If some one can tell me how to call different propoerty of a variable programmatically that may too a help alot  to me.
(e.g. color at 1 situation, size in another one, position, value. so on)

Kind regards.

naushica


0 Kudos
Message 2 of 18
(6,237 Views)
Hello Naushica,

There are two methods I can think of:

1   Create for every LED a reference (right click on terminal->Create->Reference), bundle these in an array, and index them to select the right LED1
2  Put all the LED's in a cluster (you can make the cluster border hidden if you want), use the reference to the cluster to control LED's via:
the [Controls] property gives you an array with all the refences (just like method 1), if you want to do more than basic stuff on the LED (specific Boolean actions) you should make the refences from the array more specific.

Method one gives you the a quick method, but uses a lot of space on the BD and you still have a massive number of variables on the front panel. Method two is neater but writing a value to one specific LED is more difficult (maybe you should go object oriented with the cluster).

Success,

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 18
(6,227 Views)

This can be done using the private method Set Property, but it's not recommended as a solution for a real application because private methods are not supported, possibly not working and could be removed without notice. If you want more information, search the LAVA forums.

Other ways of going about this would be:

  • Using an array where a single property node will affect all the elements in the array.
  • Using a cluster and using the Controls[] property to select which element you want to change the property of.
  • Using a subVI which will accept a reference to the control and perform the manipulations.
  • Using a state machine where you define a state (like "update UI graphs) which will be responsible of doing X and you just call that state from anywhere in the program and so on.

You might wish to look up some material on programming style and methods. To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
Message 4 of 18
(6,230 Views)
Ok This is great help.

I made  a simple program & from the control[] property I indexed the reference of LED I want to change.
But in that list of proprties I couldnt find any color propoerties to change the color of LEDs .
Y is that?
Am I doing the wrong method?
I went through another propoerty called decorate[] but that also didnt went ok.

I am using the method no. 2. I put all LEDs in to a single cluster.


what should I do if I want to change the ON color and OFF color of a single LED in a cluster?

regards.


0 Kudos
Message 5 of 18
(6,214 Views)
You should select the right boolen from this [controls] array  see attachment
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 6 of 18
(6,208 Views)
Thank you very much.
It works pretty neatly now.
I could save lot of BD space by this way.
It was a headache programming all these times in making a lot of property nodes.

By the way I want to ask a one last question. you mentioned that it is possible to make invisible the boundary of a cluster.
How can I do it?.

regards.

Naushica


0 Kudos
Message 7 of 18
(6,207 Views)
nice it works, hope you can explore the properties more and more. I think there is even a property to do the following with the [decorations] of a cluster, but let's do it the manual way:

select the brush tool
right-click the cluster border
press space bar to select front- and background color
select the T box in the right upper hand, this should remove the border, in addition you could also make the background of the cluster transparant,

Ton

Message Edited by TonP on 05-31-2006 09:52 AM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 8 of 18
(6,195 Views)
I have a similar (somewhat similar) issue..  I did read what tst proposed... many times over...
 
Here is the scenario. 
 
I have many controls and indicators that I want to change properties from visible to invisible and back to visible.
They start by being invisible.  Depending on operator selection some indicators / controls may become visible.  And again, based on certain selections, they may become invisible (again) and others become visible.  The controls & indicators are of different types, from boolean, text, numeric, image, etc...
 
The main vi, which was relatively clean now has become cluttered with approx 60 (seventy) property nodes which make the control / indicator visible / invisible.
 
There are other property nodes (approx 10) which modify values based on selections... We won't get into those at this time.
Is there a way other than clusters to reduce the number of property nodes to something like 5... (maybe 10).  I do know about the references...  What I'd like to accomplish is using an array of element names (ctrl / indicators) and feeding a loop which would set the appropriate attribute; especially since the property is chnaged in groups of elements at a time.  
 
How to explain this....  so that it makes sense...
 
Take a look at the attached image.  The simplest form of the question would be:  "I want to have a single property node inside a loop which would make all seven (7) controls become invisible".
 
-- now I need a coffee --
 
JLV
Message 9 of 18
(6,107 Views)
Hi Ray!
 
I think I read Darren uses an approach similar to what I have used.
 
I use an action engine that is initialized at start-up time by passing a cluster that has a reference to every control. The cluster passed in by the caller is then stored in a shift register for use later.
 
Any time the visability of controls have to change, the action is invoked using approiatly named actions like "Show Config contorls" or "Hide All", etc.
 
I hope that is enough info for you to run with it.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 18
(6,097 Views)