LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to display multiple string on single string display depending on multiple condition

Solved!
Go to solution

Hello Friends,

 

I want to display three string on one string display depends on three inputs.

if CAB1 button is high sting should display CONTROL-1 and CAB2 button is high string should display CONTROL-2 and if CAB3 button is high string should display CONTROL-3 and if non of the button is high the string should display CONTROL-OFF.

I have attached snippet Please check as it auto display default state after time is over.

or any other idea please share.

 

Thanks

0 Kudos
Message 1 of 7
(3,539 Views)
Solution
Accepted by topic author Asif138

Hi Asif,

 

Website is not letting me attach any VI so I am attaching some screenshots showing one of the way of a achieving what you need:

 

XM43_0-1671106724527.png

XM43_1-1671106736437.png

XM43_2-1671106752419.png

 

XM43_3-1671106760941.png

Hope this helps.

 

Message 2 of 7
(3,509 Views)

Many thanks 

 

it is working as i want but just one justification that why there is not case # 3?

 

 

Thanks again.

 

0 Kudos
Message 3 of 7
(3,500 Views)

@Asif138 wrote:

Hello Friends,

 

I want to display three string on one string display depends on three inputs.

if CAB1 button is high sting should display CONTROL-1 and CAB2 button is high string should display CONTROL-2 and if CAB3 button is high string should display CONTROL-3 and if non of the button is high the string should display CONTROL-OFF.

I have attached snippet Please check as it auto display default state after time is over.

or any other idea please share.

 

Thanks


What should be displayed if more than one button is TRUE?  Would a Radio Button control with C1, C2, C3 options and mode set to 0 or 1 selections be better for the User Experience?  Might a Enum or Ring be a better option for the indicator?

 

Myself, I wold try a radio button and a Radio Button value change event reading the Radio button inside that event case.  Then just set the indicator value in that event case whenever the user clicks on a button in the radio control.  And simply reset the Radio control in the timeout event by writing to its "value (signaling)" property with a property node the property write will also trigger a value change event to automatically update the indicator. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(3,497 Views)

Hi Asif,

 

You may want to learn about Binary to Decimal Conversion and that will answer why there is no case #3. If you want to add more possibilities, select those buttons and check for the output number.

001= 1

010= 2

100= 4

011= 3

etc

 

Also, has made a good suggestion. Please consider implementing it if your application is supposed to grow more than what you have right now.

Edit: It would be a good practice for long term.

 

0 Kudos
Message 5 of 7
(3,482 Views)

Thanks for your replay

actually, this button could never be true at the same time in my project.

 

Thanks

asif

0 Kudos
Message 6 of 7
(3,363 Views)

@Asif138 wrote:

 

actually, this button could never be true at the same time in my project.


Well, you really did not explain the entire back story. Where do the boolean values come from? (from some device or from a user input? Why isn't it an array of booleans?)

 

As has been said, if this is a user input, you should use a radio-button control, else you need to do some conflict resolution to decide what do to if more than one is true by accident. You could even use an integer dial or slide with four positions and text marker label.

 

If the data comes from an external device that guarantees that only zero or one can be true at any give time, here's what I would do. It is much easier to read and maintain if the strings are not scattered across many cases of a case structure.

 

(If all possible combinations can exist, it will return the first true found. If you want different strings for all 2^3 possibilities, use the earlier shown code and use an array with 8 elements). 

 

altenbach_0-1671378144080.png

 

0 Kudos
Message 7 of 7
(3,345 Views)