LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A very simple question

This is possibly a very simple question... sorry but its the end of the day and my head is just about ready to explode.

 

I essentially want 2 booleans controlling a case structure.... 1 boolean handles the true case, the other the false case.

 

How do I do this? "Or" does not work or so i think 😞

0 Kudos
Message 1 of 14
(7,932 Views)

With two booleans, you can have up to 4 cases (f/f, f/t, t/f, f/f). A singe boolean case structure is insufficient because you don't have a case for when both are FALSE or both are TRUE.

 

One possibility (there are many more!):

 

Make the two booleans into an array using built array, then use "boolean array to number" and wire the number to the case structure. Create cases 0, 1, 2, 3 according to your requirements. (E.g. merge case 0 and 3 and leave it empty and use the two other cases for your original needs.

 

 

 

0 Kudos
Message 2 of 14
(7,927 Views)

Are the booleans controls a user is selecting or are they the outputs of some other process? If they are outputs from some other piece of code you will need to do something like altenbach suggested. If a user is making the selection and it is mutually exclusive then perhaps an ENUM or ring would be a better method for making the selection.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 14
(7,909 Views)

Sorry for the typo, earlier I meant of course "... 4 cases (f/f, f/t, t/f, t/t)"

 

Also, if exactly one is guaranteed to be true when the code occurs (e.g. if the two latching booleans share a value change event), just hook the case structure to only one of them and place the associated code in the true case. Put the case for the other boolean in the FALSE case and leave the terminal of the boolean unwired, but also placed inside the event case.

0 Kudos
Message 4 of 14
(7,901 Views)

Change the booleans to radio buttons?  Connect radio button terminal to case structure.  Works.  Expandable. No t/t f/f cases.

 

Lynn

0 Kudos
Message 5 of 14
(7,872 Views)
You could also build those two booleans into an array, convert it to number and wire it to the case structure... This way you can use all the four cases.. i.e., t/t, f/f, t/f, f/t. Regards, Prashant
0 Kudos
Message 6 of 14
(7,845 Views)

Hi,

 

You can make use of formula node.

 

Please refer the atached VI.

 

Regards

Haneef

0 Kudos
Message 7 of 14
(7,830 Views)

Is this thread turning into the twilight zone???? 😄

 

First Prashant repeats the suggestion of my very first answer.

 

Then, finally, Haneef comes up with a rube goldberg formula node contraption that has 90% too much baggage for what it does, including unneeded locals and has a loop that consumes 100% CPU doing almost nothing. 😮

 

Bring back the sanity!!!! 😄

0 Kudos
Message 8 of 14
(7,801 Views)
Am sorry altenbach, i had not seen your answer while i was replying... i just saw it now.. Am really sorry.. Regards, Prashant
0 Kudos
Message 9 of 14
(7,794 Views)

Ah don't worry about it, sometimes we miss things 😄 After all, it's an obvious solution....

 

Thanks for participating!

0 Kudos
Message 10 of 14
(7,784 Views)