Users can build various logics into their system at different stages, like during Survey creation, Sample Lists creation and monitoring and tracking a survey. The logic includes skip logic, Validation, Set value, Question/Option masking, filtering sample lists etc., which is done via the Logic Builder.
Let us consider an example of Logic builder that appears while applying Question masking. (Refer article Hiding question based on logic)
The Logic Builder opens up with AND condition by default and options to add rule where you can specify your logic.
Click on “+” sign to add row where you can specify your logic.
A row will get added in your logic builder as below:-
The added row will contain four fields which has specific contents as below:-
- The First field of the row gives you two options: Survey and Sample data.
Choose survey if your logic is based on a question you created in your survey. Choose sample if your logic is based on the sample data (the one you created in your Distribution list. (Refer Section Distribution List)
For the example that we are considering, choose the option as “Survey”.
- The Second Field displays questions. This is dependent on the first field. If you choose Survey in your first field, it will show all the survey questions that you created before the question you are currently working upon.
- The Third field gives you the “condition list” from which you can choose whatever condition you want to apply for your option display logic.
Note: The conditions given in the third Field changes according to the question type selected in Field 1, The conditions remain same for categorical questions(Single choice and multi choice), but differs when selected question type is numeric, text, grid etc.
- The Fourth field displays the question options you selected in the second field.
The entire fields combine together to create one logic based on which the results will be shown.
The AND/OR logic applied holds no importance until there are two rows between which the AND/OR logic is specified.
Click on the “+” Add Rule icon again to add another row/rule in your logic builder.
A new rule will be added below your previous rule. Define logic in your added rule and select between AND/OR conditions to be applied between the two rules.
If AND condition is selected, that means the logic will be applied if both the conditions are true. If OR condition is selected, that means logic will be applied if either of the two defined conditions is true.
After defining rules, click on SET to apply the logic.
Adding Groups in Logic Builder
Users can also create groups in Logic builder. Each group will have its respective set of rules. AND/OR condition can then be applied between Groups as well.
Click on the Add Group icon to add a group.
Group will get added.
Click on Add Rule icon to add rules to your group.
Follow and repeat the above steps to add multiple rules and groups to your Logic Builder.
Users can delete their rules and Groups by clicking on the “Delete” icon in the Logic Builder.
Saving/Loading Logic
Users can Save/Load their created logic in Logic Builder and can later use them to apply in any other similar scenario.
Click on Save. A drop-down will appear. Enter the name for your Logic and click on save button.
Your logic will get saved and can now be viewed by clicking on Load. All the saved logic can be viewed by clicking on Load.
From the loaded list of saved logic, select the logic you wish to load and click on Set to apply the logic.
An automatic script will be generated where the users will define their logic. This script can be viewed by clicking on Script.
Instead of adding rules/groups, users can also write and apply the direct script if they have a good hand at scripting.