Simplify Cascade Conditions

Edit in →
Survey Creator

In a cascade condition, a question's visibility depends on the previous question, whose visibility, in turn, depends on a question before it, and so on. Cascade conditions may result in lengthy Boolean expressions because each expression must include conditions from previous cascade levels. In this example, questions form the following multi-level cascade: Read more...

Themes
Color palette
Question appearance
Sorry, we can't retrieve the data from server. Please comeback later.

In a cascade condition, a question's visibility depends on the previous question, whose visibility, in turn, depends on a question before it, and so on. Cascade conditions may result in lengthy Boolean expressions because each expression must include conditions from previous cascade levels. In this example, questions form the following multi-level cascade:

"age18" → "haveKids" → "kidCount" → "kid1Age", "kid2Age","kid3Age", ...

Each question beginning with "haveKids" depends on the answer given to the previous question. Typical visibleIf expressions in this case look as follows:

{
  "elements": [{
    "name": "age18",
    "title": "Are you 18 years old or older?"
  }, {
    "name": "haveKids",
    "title": "Do you have children?",
    "visibleIf": "{age18} = 'Yes'"
  }, {
    "name": "kidCount",
    "title": "How many children do you have?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes'"
  }, {
    "name": "kid1Age",
    "title": "How old is your first child?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes' and {kidCount} >= 1"
  }, {
    "name": "kid2Age",
    "title": "How old is your second child?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes' and {kidCount} >= 2"
  }, {
    "name": "kid3Age",
    "title": "How old is your third child?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes' and {kidCount} >= 3"
  }, {
    "name": "kid4Age",
    "title": "How old is your fourth child?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes' and {kidCount} >= 4"
  }, {
    "name": "kid5Age",
    "title": "How old is your fifth child?",
    "visibleIf": "{age18} = 'Yes' and {haveKids} = 'Yes' and {kidCount} >= 5"
  }]
}

As you can see, cascade conditions accumulate, and the visibleIf expressions for the lowest-level questions ("kid1Age", "kid2Age", etc.) include conditions of the higher-level questions.

To shorten expressions, you can set the clearInvisibleValues property to "onHidden". With this setting, expressions can take into account only the previous-level question, as shown in this example. Without clearInvisibleValues set to "onHidden", such behavior is impossible because hidden questions retain their values. If you used shorter expressions in this case, a change in a higher-level question wouldn't propagate down the cascade, and lowest-level questions would remain visible even though questions upon which they depend were hidden.

Note that this simplification also slightly changes the behavior. If a question had a value before hiding, this value will not reappear after the question becomes visible again. If this is not the desired behavior, we recommend using lengthy expressions.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.