From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

value of one enum variable depends on another

Hi guys I tried to chage the selection values of one enum varible to chage depending on another enum varable. LIke a select device will decide the which will operate and depending upon the device selected a set command will apper in another variable....

No clue weather it is possible or not???? 😕

0 Kudos
Message 1 of 8
(3,342 Views)

Hi newbee,

 

yes, it's possible to set a control to specific values depending on inputs of other controls...

 

Maybe you should explain in more details or attach your VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,333 Views)

It is NOT possible to change the item themselfes for enum controls. For enums, you can only change the selected (active) item by simply setting the enum to the requested value. But the dropdown content (selectable items) will not change.

 

You have three (or more) workarounds:

 

a) Work with ComboBoxes since those allow to modify items during runtime.

b) Work with disabling items in enums (see attached example).

c) Create different enums and place them above each other. Work with the visibility property to display only the "active selection enum" at a time. 

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 8
(3,328 Views)

@Norbert_B wrote:

It is NOT possible to change the item themselfes for enum controls. For enums, you can only change the selected (active) item by simply setting the enum to the requested value. But the dropdown content (selectable items) will not change.

 

You have three (or more) workarounds:

 

a) Work with ComboBoxes since those allow to modify items during runtime.

b) Work with disabling items in enums (see attached example).

c) Create different enums and place them above each other. Work with the visibility property to display only the "active selection enum" at a time. 

 

hope this helps,

Norbert 


Combo boxes if you want a string output

Ring controls if you want numeric outputs. you can edit the 'strings'  and 'string and values' properties during run time

 

Edit: you said 'command should appear in another variable'. Do you want to update a list of commands in the pull down menu depending on the device selected? Then, combo boxes are better as they can give you string outputs, unlike rings and enums.

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 4 of 8
(3,323 Views)

Thanks everybody for their suggestion and I think I have an idea but still I am posting my VI. In the block diagram nothing is their because that still under development but if you see front panel you will find a device select ENUM is present now depending upon what device you select you will different set of commands in command select button...

That is my question that can change is display of a enum variable by changing another

0 Kudos
Message 5 of 8
(3,314 Views)

Hi newbee,

 

use a ring and use it's Strings[] proeprty to set selection strings depending on your device.

 

Or use an enum with all possible selections and disable entries unsuitable for the selected device.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(3,307 Views)

Hi GerdW, I am new to LV, Can you say how to do the following " use a ring and use it's Strings[] proeprty to set selection strings depending on your device." ?

0 Kudos
Message 7 of 8
(3,186 Views)

Hi 23,

 

- A "ring" is a certain front panel ("FP") element. You will find a ring control in the rings & enum palette.

- Each FP element has properties. You can edit the properties using the right-click (aka "context") menu of that control and selecting items like "datatype". And you can also set those properties programmatically using property nodes - you can create them also in the context menu…

 

One property of a ring control is the array of strings it will show to the user…

 

As you say you're a newbie I recommend to take all those free online courses offered by NI on their website!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,158 Views)