**Keywords**: x

**Description**: Describes how to build Advanced Ask if rules to set complex logic (e.g. logic based on more than one question).

Use Advanced Ask if Logic to add conditional logic that is not supported with the standard Ask if Logic in Vista. For example, if you want to have a conditional that is based on the answer to two separate questions you will likely need to use Advanced Ask if Logic.

**Note**: In most cases you can use a combination of standard Ask if Logic and the Go To Question to set up conditional logic in a survey. Since this method is much simpler than using Advanced Ask if Logic, you should always try to set up your logic using this method, and only use Advanced Ask if Logic if you can't get your conditional logic implemented with standard functionality.

**Adding an Advanced Ask if Condition**

Here is how to set up an Advanced Ask if condition for a question:

- In the Question Editor for the question, click the
**Ask if**button.

- From the drop-down box asking you to pick the dependent question, choose
**Other**.

- Enter the conditional statement you want to use (see below for more details).

**Conditional Statements**

Conditional statements are built using a combination of question pipe codes (e.g. [Q1] or [V1]), operators, and possibly commands. Conditional statements use a Javascript syntax. The following are some examples of conditional statements:

[Q1]>[Q2] | Question 1 is greater than Question 2 |

[Q1a]+[Q1b]+[Q1c]!=100 | Questions 1a-1c do not add to 100 |

[Q1]>10&&[Q2]>20 | Question 1 is greater than 10 AND Question 2 is greater than 20 |

[Q1]==0||[Q2]==0 | Question 1 equals 0 OR Question 2 equals 0 |

len([Q1])>=5 | Question 1 is at least 5 charactsers in length |

max([Q1a],[Q1b],[Q1c])<5 | The maximum value of Q1a-c is less than 5 |

index([Q1],"@")==-1 | Question 1 does not contain a '@' character (i.e. simple email validation) |

count(tolist([V1],","))==3 | Exactly 3 options are selected for Question 1 (Select Many question) |

For more information about conditional statements, see the following pages:

Using Piping

Formula Operators

Formula Commands