10-26-2017 03:49 AM - edited 10-26-2017 03:51 AM
Hi,
I want to request if a scanned variable is 0 or 1.
When 1: next step
When 0: false, call sequence or something like that
What´s the best oppurtinity to check it?
If/else?
Expressions?
Extra Statement Step?
Kind Regards,
Andreas
10-26-2017
04:17 AM
- last edited on
10-25-2024
03:41 PM
by
Content Cleaner
For me it would come down to the number of steps I wanted to run (or not run) depending on the state of the variable. If it were a single step then I would go for a PreCondition (see PreConditionBuilder) on that step, for multiple steps I would go for an If/else.
NOTE: PreConditions are cool, but you sacrifice a little readability.
10-26-2017 05:16 AM
Hi,
thanks for your reply. But the Preconditon expected Boolean, but found a Number (because my variable is a number variable with 0 or 1).
Can I "Change" the numbers into a boolean?
Kind Regards,
Andi
10-26-2017 05:30 AM - edited 10-26-2017 05:36 AM
Hi Andi
Yes, a PreCondition evaluates an expression that needs to result in a Boolean. For your purposes (numeric), your PreCondition needs to be an expression that tests the value of your numeric in a way that gives you a Boolean result. Here are a few PreCondition examples hopefully one will suit you purposes:
Locals.YourVariableHere == 0 (Run the step if your variable equals 0)
Locals.YourVariableHere != 0 (Run the step if your variable does not equal 0)
Locals.YourVariableHere > 0 (Run the step if your variable is any positive number greater than 0)
Locals.YourVariableHere <= 4 (Run the step if your variable is less than or equal to 4)
(Locals.YourVariableHere == 1) || (Locals.YourVariableHere > 3) (Run the step if your variable is equal to 1 or is greater than 3)
Regards
Steve
10-26-2017 08:28 AM
Hi Steve,
thanks, it helps me a lot.
Regards