If Else
Compare the value of a variable with another specified value to determine whether a condition is TRUE or FALSE. Based on the outcome, direct the logical flow of the wizard along two or more different paths (i.e., if the condition is TRUE, follow Path A; if the condition is FALSE, follow Path B.)
Step 1: Define the condition
The first step in using the IF ELSE command is to define the condition (i.e., set up a comparison).
-
Enter the name of the variable whose value you wish to compare with another value.
-
Select the type of comparison to perform:
-
equals (with options to ignore letter case/use wildcards/allow close match)
-
contains (with option to ignore letter case/allow close match)
-
match regular expression (with option to ignore letter case)
-
is greater than
-
is greater than or equal to
-
is less than
-
is less than or equal to
-
begins with (with option to ignore letter case)
-
ends with (with option to ignore letter case)
-
is empty
-
is defined
-
-
Enter the value with which you wish to compare the variable's value (can be entered manually or copied from values stored in variables).
-
Indicate if you wish to perform a reverse comparison (e.g., variableIS NOT greater than or equal to
0
). -
(Optional) Use Else If to set up multiple comparisons if you need to define 3 or more possible outcomes. To learn more, see Else if.
Step 2: Define the actions
Upon adding the If Else command to your wizard, you will notice that it becomes an empty "container" within the Editor Pane, waiting for you to fill it with instructions:
-
Enter the action(s) the wizard should take if the condition is TRUE.
-
You can do this by dragging the required Advanced Command(s) directly into the container
-
-
Enter the action(s) the wizard should take if the condition is FALSE.
Let's say you want your wizard to check if the folder c:\my folder
exists.
-
If it does (the condition is TRUE), you want to copy a file to it
-
If it doesn't (the condition is FALSE), you want to skip to the next step
A combination of a few Advanced Commands will help you get this done:
-
Use the Does Folder Exist command to check if the folder exists.
-
Based on the outcome of the check, use the If Else command to direct the wizard on one of the two possible paths.
Else if
If you need direct the flow of your wizard among 3 or more different logical paths, you can use the Else if option to add additional comparisons. The resulting logic (for 3 possible paths) might look something like this:
-
If the result of Comparison #1 is TRUE → follow Path A
-
If the result of Comparison #1 is FALSE → perform Comparison #2
-
If the result of Comparison #2 is TRUE → follow Path B
-
If the result of Comparison #2 is FALSE → follow Path C
-
Your auto insurance company assigns rates for its collision policies using different rate tables based on the insured's age:
Insured's Age |
Rate Table |
---|---|
65 + |
RT1 |
25 - 65 |
RT2 |
Younger than 25 |
RT3 |
-
Use the If Else command with one Else If option to perform the required comparisons and direct the wizard among the 3 possible paths.
-
On each of the paths, use the Set Value command to store the correct rate table for the insured into a variable called rate table.