Working with Conditional Logic


Zapof Conditional Logic uses spreadsheet functions to give the maximum flexibility to meet any demand in day-to-day tasks.


The conditional logic determines whether to show a question or web element based on the answers of other questions. Zapof Conditional Logic uses spreadsheet functions to evaluate answers from the following types of question:
  • Text input field (single-line or multiline).
  • Currency and numeric input field.
  • Custom format input field such as a formatted phone number or social security number.
  • Table cell.
  • Checkbox and yes/no input field.
  • Choice input field (single or multiple choice).
  • Drop-down choice input field (single or multiple choice).
  • Email input field.
  • Date, time and date/time input field.
  • Birthday input field.
  • Rating, bipolar, star, and smiley scale input field.
  • Matrix input field.
  • Ranking input field.
  • Constant-sum input field.
  • File and image upload input field.
  • Signature input field.
  • Download link.
  • US-State and Country drop-down input field.
You can find out the return value of a question on the 'Add' panel after you click the 'Add Question & Element' button on the left toolbar, or by clicking the branching icon on the element's toolbar.





Let's create a simple dessert order form from scratch. The user chooses the dessert from a drop-down multiple choice input. We give an option for the user to order one more for each choice. When the user selects a dessert such as chocolate custard, a checkbox appears, asking if the user wants to add one more.
The drop-down multiple choice contains:
  1. Ice cream cone.
  2. Shaved ice.
  3. Strawberry cake.
  4. Chocolate custard.


Adding a drop-down multiple choice input.

  1. Click the ‘Add Question & Element’ button on the left toolbar. It opens the ‘Add’ panel with all types of questions and web elements.
  2. To find the table element, type drop-down into the search input and press Enter.
  3. Click the ‘Add’ button on the ‘Multiple choice input field’ card.
  4. To edit the text of the input field, click the pencil button on the element's toolbar, or click the ‘Enter Text’.
  5. Type 'Please choose your desserts:'
  6. Click the pencil button to deactivate field’s text editing.
  7. Click the 'Edit drop-down choices' button on the drop-down's toolbar. The drop-down reveals the choices so you can add, delete, and edit the choices.
  8. Click the 'Choice A' and change it to 'Ice cream cone'.
  9. Click the 'Choice B' and change it to 'Shaved ice'.
  10. Click the 'Add a choice' button on the drop-down's toolbar. Click the 'Enter Text' and change it to 'Strawberry cake'.
  11. Click the 'Add a choice' button on the drop-down's toolbar. Click the 'Enter Text' and change it to 'Chocolate custard'.
  12. Click the 'Append line break' button at the bottom-right corner of the drop-down input.
  13. Click the small circle of the just added line break.
  14. Click the ‘Add Question & Element’ button on the left toolbar. Type checkbox into the search input and press Enter.
  15. Click the ‘Add’ button on the ‘Checkbox’ card. Click the ‘Enter Text' and change it to 'Add one more ice cream cone'.
  16. Click the 'Append line break' button at the bottom-right corner of the checkbox input.
  17. Click the small circle of the just added line break.
  18. Repeat the above two steps to add the rest of the checkboxes: 'Add one more shaved ice', 'Add one more strawberry cake', and 'Add one more chocolate custard'.
You should see your dessert order form:

dessert-order-form.png







Adding conditional logic formula to a question or web element.

The drop-down multiple choice of desserts returns an array of the indexes of the selected desserts.
  1. Click the 'Add one more ice cream cone'.
    Note: if you accidentally click the checkbox, click the '
    Erase initial value' button on the checkbox's toolbar to remove the tick on the checkbox.
  2. Click the 'Edit conditional formula to show/hide this question' button on the checkbox's toolbar.
  3. Enter into the formula box:

    IF( ISINARRAY(QUESTION1, 1), 1, 0)

    Click 'Apply'.

    Note: The first parameter of the IF function is the conditional check that should return TRUE or FALSE. The IF function returns second parameter when the condition is TRUE, and third parameter when it's FALSE. Our conditional formula must return either 1 or 0. The conditional logic only shows the question when the formula returns 1.
  4. Repeat the above steps for the rest of the checkbox input fields with the following formulas:

    IF( ISINARRAY(QUESTION1, 2), 1, 0) for the checkbox input 'Add one more shaved ice'.
    IF( ISINARRAY(QUESTION1, 3), 1, 0) for the checkbox input 'Add one more strawberry cake'.
    IF( ISINARRAY(QUESTION1, 4), 1, 0) for the checkbox input 'Add one more chocolate custard'.






Click 'Preview' at the top toolbar to try our dessert order form with conditional logic.











 
Created with Zapof