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: 

How to use more than two condition in if statement inside the formula node?

Solved!
Go to solution

I know how to use the if and if else in the formula node, but is there any way that I can check multiple cases inside if statement?

for instance: How to write the following syntax in the formula node?

if (u1==1) && (u2==1) && (u3==1) && (u4==1) 

 

Ameer

0 Kudos
Message 1 of 6
(3,351 Views)

Rather than futzing with the formula node, I would just use the native LabVIEW functions.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(3,310 Views)

Bill, do you mean by native LabVIEW functions the block diagram provided by LabVIEW?

Do you think this will create a bulky system?

 

Ameer

0 Kudos
Message 3 of 6
(3,307 Views)

"Bulky"?  Formula nodes get bulky.  But the main reason I would use the native LabVIEW math functions is because I don't have to check for typos.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(3,303 Views)
Solution
Accepted by topic author janabiam

Hi Ameer,

 

it gets very clean once you employ the polymorphism in LabVIEW:

check.png

Use arrays to handle the same operation on multiple elements…

 

Edit: those "u" variables probably contain boolean values, so you should also use a boolean array in LabVIEW. This way you don't even need this comparison…

Best regards,
GerdW


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

Thank you for the help.

Ameer 

0 Kudos
Message 6 of 6
(3,059 Views)