A Condition can be added to any Interaction Case in the Interaction Case Properties dialog. Defining a Condition on a Case is optional and only recommended when a high functional fidelity prototype is required. Frequently, a good Case description is an effective alternative for communicating conditional logic and can be more easily maintained.
Conditions can be based on values entered in form widgets like the check state of checkboxes and the text in text fields as well as Variables.
To add a Condition to a Case, click Add Condition in Step 1 in the Interaction Case Properties dialog. This will open the Condition Builder dialog.
Condition Builder Dialog
The Condition Builder dialog is used to construct a condition expression such as “If check state of MyRadioButton equals Checked and text on widget MyTextField equals ‘Mike’” that will be evaluated in the prototype to determine if the Actions in the Case are performed.
Clicking the “+” button at the end of a row will add an additional condition row. Clicking the “-” button will remove a condition row.
Satisfy All requires each row in the condition to evaluate to True for the Actions to be performed. This puts an AND between each row’s condition.
Satisfy Any requires one or more rows in the condition to evaluate to True for the Actions to be performed. This puts an OR between each row’s condition.
Conditions in the Prototype
Once a Condition is defined on a Case in an Event, all of the Cases in the Event will have a Condition defined. For the Cases where no Condition was added, the Condition is defaulted to “If True”.
By default, the prototype will only execute the first case where the condition evaluates to True.
In the Interactions pane, the icons on the Event will be highlighted in green to indicate that Conditions are used on the Event.
If’s and Else If’s
If Conditions are used in an Event, the Cases in the Interactions pane will have Condition text next to the Case description. For example, “Case 1 (If text on widget MyTextBox equals ‘Mike’)”. Cases after the first Case will begin with an Else If by default. In this default structure, only the first case that evaluates to True will be executed.
You can however change an Else If to an If allowing multiple cases to be evaluated and executed. To do this, right click on a Case in the Interations pane and selecting Change to IF. Similarly, IF can be changed back to Else If by right-clicking and selecting Change to ELSE IF.
Consider two Cases with two Conditions. The first is “Case 1 (If text on widget MyTextField equals ‘Mike’)” and the second is “Case 2 (Else If check state of MyRadioButton equals Checked)”.
In the prototype, if the text in MyTextField equals “Mike”, Case 1 is executed and Case 2 is ignored.
Now consider if Case 2 was changed to an If instead of Else If to become “Case 2 (If check state of MyRadioButton equals Checked)”.
Now in the prototype, if the text in MyTextField equals “Mike”, Case 1 will execute, and separately if MyRadioButton is checked, Case 2 will execute as well.