The "Decision Control Step" allows the user to implement conditional step processing. In other words, the process will perform different action steps depending on whether a condition is met.
Note: this condition(s) must be a value(s) that is located in a cell inside an Excel spreadsheet.
This step is extremely useful when the user wishes to provide flexibility to the process flow, in order to allow different actions to be performed on different process runs. This step is very often used in conjunction with "Step Dependencies" for the desired process design.
In this article, we will first go through a brief introduction of how to create a typical decision control step and the function of each of the parameters. We will then go through a simple example of using a "Decision Control Step" to implement conditional processing in a process.
Creating the Step
1. Create an action step.
2. The following window will pop-up:
Select "Decision control step" under the "Process controls" section, indicated above by the red box.
Using the Step
After creating a "Decision Control Step", you are ready to configure the step.
Link an Excel file
1. Firstly, an Excel file will need to be uploaded that will contain the conditional value(s), on which the step will depend to determine the process flow.
2. Click on "Link" in the "Excel file to test" box, to select an Excel file stored in a previous data step.
Set a condition(s)
At least one condition must be entered for the step to determine what the process should do next. These conditions are similar to a typical "IF" statement in a typical programming language.
For example, in the screenshot above, a condition was made that tests whether the value in cell A1 in worksheet "Sheet1" equals to the value "True".
These conditions also allow for other operators including, but not limited to:
- not equals
- starts with
- greater than
- less than.
Furthermore, the value that is used to compare with the cell value can either be a "Link" or "Literal".
You would use "Link" if the value is stored in a previous data step property (text box).
You would use "Literal" if the value is typed in as a literal value and does not depend on a previous data step property.
There also self-explanatory parameters such as whether the value should be case-sensitive or if leading & trailing whitespace is to be ignored.
You may also add more conditions if desired. This can be done by clicking on the "Add" button and following the same steps as explained in the previous section.
The "Minimum number of conditions to pass" list allows the user to set how many of the conditions are to be met, in order for the "Decision control step" to "pass".
Put simply, set the number to be the total number of conditions in order to achieve a typical "AND" operator.
Whereas, set the number to be 1 in order to achieve a typical "OR" operator.
However, you may also choose any other number in between.
For example, in the screenshot below, since the minimum number of conditions to pass has been set to 3, all 3 conditions (A1 in Inputs equals "True", A2 in Inputs is less than 5, B1 in Config starts with "Air") must be met for the "Decision control step" to pass. This acts in the same way as an "AND" operator.
The last section determines what the outcome of the step will be, depending on whether the conditions were met satisfactorily.
Usually, these parameters will be set so that "Outcome if test passed" is set to "pass successfully".
Whereas, "Outcome if test failed" is set to "fail".
This is useful as it allows the use of this "Decision Control Step" in conjunction with "Step Dependencies".
Example - Email if Validation Test fails
One simple example where this step would be useful is if the inputs to a process is put through a header name validation test. If the headers or the format of the input files are unexpected and fails the validation test, an email will be sent to the user, indicating that this has happened.
For simplicity and the purposes of this example, suppose that the input files are in the correct format if cell A1 in worksheet Config is equal to TRUE and vice versa.
1. Firstly, the "Decision Control Step" will be set according to the screenshot given below.
2. Next, a "Send an Email" action step is made.
3. The "Step dependencies" on "Step 1.4 Send an Email" is set it to the following configuration:
This implies that the "Step 1.4 Send and Email" action step will only run if the "Decision Control Step" fails, that is, if the input file fails the header name validation test.
4. The process is then saved and run.
The process should now behave different depending on the value in Cell A1 in Config in the Excel file.