# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

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

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

Message 1 of 6
(3,462 Views)

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

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

Bill

(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.
Message 2 of 6
(3,421 Views)

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

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

Do you think this will create a bulky system?

Ameer

Message 3 of 6
(3,418 Views)

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

"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

(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.
Message 4 of 6
(3,414 Views)
Solution
Accepted by janabiam

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

Hi Ameer,

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

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,411 Views)

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

Thank you for the help.

Ameer

Message 6 of 6
(3,170 Views)