10-07-2020 01:42 PM
This seems like a really basic question when transitioning from text based to LabView.
How does one handle the following in NXG? Basically sequential if then else?
If(condition A)
{
Output Enum Value A
}
Else if(Condition B)
{
Output Enum value B
}
...more else if's...
Else
{
Output Enum C
}
My problem is my first condition gets a true/False
I could understand if one used a case with an Enum but how do I convert my Boolean logic into Enum values?
Solved! Go to Solution.
10-07-2020 01:49 PM - edited 10-07-2020 02:37 PM
You can do all your comparisons at once, combine it into a boolean array, then search for the first TRUE. Wire the output to the index of "index array" and have an array diagram constant of enums. If it is possible that none of the conditions match, add one to the index and make the first element the default output.
Here's a simple LabVIEW example. Should be easy to transpate into NXG.
Another common "solution" is a deep stack of case structures (this should be "6.." to agree with the above code)