Page 1 of 1

Checking Variables

Posted: Mon May 01, 2017 8:24 am
by jollybv
Hi Guys

Not sure what is the correct way to do this. I have a variable called Key and a variable called Occupant now what i want is to say if key is > then 1 or key is < than (Occupant + 1) then proceed. I have tried the following key > 0 && Key < (Occupant + 1) key > 0 AND Key < (Occupant + 1) key > 0 OR Key < (Occupant + 1) but not sure which is the best way to do this

Re: Checking Variables

Posted: Mon May 01, 2017 10:47 am
by medelec35
Hi Brian,
You will need to use two pipes (|| ) :
Pipe Key.png
(5.48 KiB) Downloaded 2451 times
Which mean logical OR
So you use

Code: Select all

If: (Key >1) || (key < (Occupant + 1))
Best to separate expressions with brackets.

Note:

Code: Select all

|| = OR

Code: Select all

&& = AND 

Code: Select all

! - NOT
You may already know this, but you are able to your variables to the simulation debugger watch window ,so you can check everything is working as expected.

I have explained how to do that in FC6 here.
Its exactly the same method for Flowcode V7

Just curious, but that statement only be false when Key = 1 and Occupant = 0
Is that what you're after?

Martin

Re: Checking Variables

Posted: Mon May 01, 2017 11:31 am
by jollybv
Hi Martian

Thanks for the replay what I'm looking for is if the variable is between 1 & whatever i set the Occupant variable

Re: Checking Variables

Posted: Mon May 01, 2017 11:42 am
by medelec35
Hi Brian
jollybv wrote:if the variable is between 1 & whatever i set the Occupant variable
Sorry I was taking this as a literal expression :
jollybv wrote: if key is > then 1 or key is < than (Occupant + 1) then proceed.

All you need to do is use AND (&&) instead of OR.
So:

Code: Select all

(Key >= 1) && (key <= Occupant)
Martin

Re: Checking Variables

Posted: Mon May 01, 2017 12:16 pm
by jollybv
Hi Martin

Thanks again yes that makes sens to me now