Now let's learn a few more RuleZ operations that we can use to solve a different problem.  For this example, we will be using the same question set:

What we want to do (expressed in simple English) is:

  • Check if the shopper ordered a combo meal
  • If they did, show a question about the quality of the fries, otherwise hide it.

Looking at our question list and adding in question IDs, we now have:

  • Check if the answer to question 31 is Combo meal (option 3)
  • If it is, show question 41, otherwise hide it

We're going to use ifQ again (ifQ (41)), but we need two new operators.  The first is the .answered operator, which we can use in several ways:

.answered()             // If it's answered at all

.answered(1)            // If answer 1 was selected

.answered(1, 3)         // If answer 1 or answer 3 was selected

.answered([1, 2])       // If answer 1 AND answer 2 were selected

.answered([1, 2], 3)    // If answers 1 and 2, OR answer 3 were selected (multicheck)

 // In this case, we want to know if answer 3 was selected:

ifq(31)              // If the answer to "What did you order?"
.answered(3)         // is "Combo meal"

Now we need another new operator: .appear.  This causes a question to appear if the previous operations resulted in "Yes":


There is also a .disappear operator that can be used to control whether a question appears:


The easiest way to remember how .appear and .disappear work is to remember that the normal state of the question is the opposite of whatever the operator is telling you to do.  Thus, if you use .appear (Q(41)), question 41 is normally NOT displayed, and is only displayed if your Rule condition is met.

 Our Rule (with comments) now looks like this:

ifQ(31)            // if the answer to "What did you order?"
.answered(3)       // is option 3 (Combo Meal)
.appear(Q(41));    // show the "Were your fries tasty?" question

 Let's add it in the RuleZ Editor.  Note that your previous Rule is already there – just add this one to the end:

Check your ruleset for errors and save as before, then create a test shop once again. 

When you first open the test shop, question 41 should NOT be visible:

Fill out the shop, selecting the third option for the "What did you order?" question.  As soon as that option is selected, question 41 should appear:

As with the previous Rule, make sure to check the other conditions as well.  What happens when you click the other options? Does question 41 disappear?  Then you're all set!

Now that you know the basics of how RuleZ work, there are two more places you can look for more information:

The Rulez Reference:  this section lists all the Rulez checks, comparisons, and actions.  Want to see everything that RuleZ can do?  This is the place!

Advanced Rulez: this section teaches you how to create RuleZ that take effect if multiple conditions are met, or that affect sections and ranges of questions.