How-Tos

How to use if-else conditionals

In this video, you will learn how to use conditional expressions using the if-else-block.

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:

  1. In our example, we have a form with a radio button selection to create either document A or B.
  2. Next, we add an if-else block under General via drag & drop. We confirm the dialog with OK.
  3. Now we connect the input of the if-else block to the output of the form block.
  4. Then we connect the output True of the If-Else block to document A and the output False or Else to document B.
  5. 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.
  6. Select the If-Else block with the mouse and then click Connect Data.
  7. The Logic Editor opens.
  8. On the left side, the check box selection 'Generation' of the previous form is displayed in the color orange.
  9. Drag and drop the 'Generation' element from the left side to the center.
  10. As a comparison value, we create a value of type Text with the value 'doc a' under the General library.
  11. 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.
  12. Then we connect the inputs of the text ''Text A is the same as B'' blocks with the form and the value.
  13. Finally, we connect the output of the 'Text A is the same as B' block to the input of the If/Else block.
  14. We close the Logic Editor.
  15. 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.

Similar posts

Subscribe to our newsletter

Stay up to date on upcoming news and topics of creating web apps without code.