Enhanced Surveys - Advanced Conditions


Enhanced Surveys - Advanced Conditions

Please Note This article is for users who are comfortable with the Enhanced Surveys survey builder and already use the basic conditional options on components.

Enhanced Surveys contains the ability to create calculated fields and complex conditional queries by using json. Here are some code snippets you can use:

component is the name of a component (you can find the name rather than the label on the API tab of the component).

Calculation Options

+ Add

- Subtract

* Multiply

/ Divide

= Equals

!= Does not Equal

Calculated Values

You can make any field a calculated value using javascript code snippets.

value = data.component + data.component;

value = data.component + 1;

If clauses

You can include if clauses with your calculated values and advanced conditions with the following snippet

if (data.component >= data.component) { value = "PASS"; } else { value = "FAIL"; }

You can add more clauses by specifying adding another line starting with else if

Advanced Conditional Questions

You can also use javascript code snippets to create more complex conditional criteria. To add these to a component, go to the component’s Conditional tab and open the Advanced Conditions section. You can then type in javascript to complete the conditions


and is written as ‘&&’ e.g.show=(data.radio1>1&&data.radio2>1);

or is written as ‘||’ e.g. show=(data.radio1>1||data.radio2>1);

equals is written as ‘==’ e.g. show=(data.radio1==1&&data.radio2==1);