01-20-2011 03:38 PM
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 😞
01-20-2011 03:48 PM - edited 01-20-2011 03:49 PM
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.
01-20-2011 04:24 PM
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.
01-20-2011 04:40 PM - edited 01-20-2011 04:43 PM
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.
01-20-2011 06:47 PM
Change the booleans to radio buttons? Connect radio button terminal to case structure. Works. Expandable. No t/t f/f cases.
Lynn
01-20-2011 10:16 PM
01-21-2011 12:01 AM
Hi,
You can make use of formula node.
Please refer the atached VI.
Regards
Haneef
01-21-2011 02:21 AM
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!!!! 😄
01-21-2011 02:40 AM
01-21-2011 02:48 AM
Ah don't worry about it, sometimes we miss things 😄 After all, it's an obvious solution....
Thanks for participating!