if
Summary
This Action returns values that fits the condition.
Description
The IF statement executes a statement if a specified condition is truthy.
If the condition is false, another statement in the optional ELSE-IF clause will be executed.
Fields
In IF Action there are 3 type fields.
- IF : To check condition
- return : Return result If the condition is True
- ELSE-IF : Add more IF condition
- IF
This field is to check If condiion.
Basically, default is 'Boolean Type'.
Also, you can change the type to 'References Data', 'Action', 'Condtions', 'Comparisons' like below.
- return
This field determines how to return the value that returns when the if statement is true.
You can change the type to 'Values (string, number...)', 'References Data', 'Action' ...' like below.
- Add ELSE-IF
This field to use when you want to add more if statements.
Click to add more else-if statements, as shown below.
If you add Else-if and set the boolean true value in ELSE-IF field,
the return value can be set to a value that comes out as default in the if statement.
Example
Let's See how to use IF Action!
Using Comparisons
Let's imagine.
I want to make an if statement true only when data with reference data is data that meets the criteria I set.
We will put the string 'Autoflow'
in the ref_data
,
the value to true
only if the ref_data
coming through the if statement is 'Autoflow'
.
We will get Action result like below.
- If condition is
true
, it would returnTrue Result!
- If condition is
false
, it would returnFalse Result!
1. Prepare Reference Data
We will make Reference Data by 'Variable/set Action'
I just add value
as String, then I put 'Autoflow'
in value.
Then I changed OUTPUT
's name to 'ref_data'
2. Change IF Action's Conditon.
I just Click 'boolean'
in IF field, Then Click 'equal'
Then Click 'number'
in IF field.
Then Click 'data'
button.
Change Scope and Path as variable > ref_data
Then Click 'number'
in IF field.
Then Click 'string'
We are ready to Comparison to use IF Action now! 👏
3. Setting return
field.
Click null
in return field, then click string
Write True Result!
in return field in string
,
Then click Add ELSE-IF field to add default
Write False Result!
in return field in string
,
We are ready to get result to use IF Action now! 👏
4. Get a result by using Simulation
!
Start Simulation, then See the result! 👀
You don't know how to use Simulation
in Autoflow?
Then, Click here! 🔗
I put comparison string to Autoflow
and ref_data
is Autoflow
.
That means I will get True
result from IF
Action.
Now we can see True Result!
in Action output.👀
I put comparison string to eric
and ref_data
is Autoflow
.
That means I will get False
result from IF
Action.
Also we can see False Result!
in Action output.👀