How to use if-else conditionals
In this video, you will learn how to use conditional expressions using the if-else-block.
Sebastian
Jan 29, 2023
In this video, you will learn how to use conditional expressions using the if-else-block.
Conditionals are commands for handling decisions. Conditionals perform different computations or actions depending on whether a boolean condition evaluates to true or false.
Steps:
- In our example, we have a form with a radio button selection to create either document A or B.
- Next, we add an if-else block under General via drag & drop. We confirm the dialog with OK.
- Now we connect the input of the if-else block to the output of the form block.
- Then we connect the output True of the If-Else block to document A and the output False or Else to document B.
- Now we need to define the logic inside our if-else block to decide when to create which document depending on the selection in the form.
- Select the If-Else block with the mouse and then click Connect Data.
- The Logic Editor opens.
- On the left side, the check box selection 'Generation' of the previous form is displayed in the color orange.
- Drag and drop the 'Generation' element from the left side to the center.
- As a comparison value, we create a value of type Text with the value 'doc a' under the General library.
- To be able to compare the selected value of the checkbox in the form with the value, we create a block 'Text A is the same as B' under Text.
- Then we connect the inputs of the text ''Text A is the same as B'' blocks with the form and the value.
- Finally, we connect the output of the 'Text A is the same as B' block to the input of the If/Else block.
- We close the Logic Editor.
- The flow is now configured and can be tested, for example, using the preview mode
If we select Document B in the selection and then click Submit, we get Document B created.