Adding Conditional Logic
Learn to use rules in iRise to control actions and display dynamic content in iRise Editor.
Setting rules for Action Sequences
To mimic realistic application behavior, it’s often helpful to add simple rules that control which actions should run based on certain conditions. For example, clicking on a button may show an error message or advance the user to next screen based on whether a required field has been entered. Action Sequences allow you to define a series of Actions and define the condition, or rule, that must be satisfied for those Actions to run.
When you add multiple actions to the same trigger (ex. “Click”), you can choose whether to add the action to an existing Action Sequence or add new one.
Once your Action Sequences are defined, you can set up a rule for each one. In the example below, clicking on the “Continue” will be set up to do the following:
- Show an error message if “ID” is empty
- Save user inputs and advance to the next screen if “ID” is not empty
Setting rules for Viewstacks
To mimic realistic application behavior, it’s often helpful to create dynamic screens or UI elements that can display different content based on certain conditions. For example, when the user clicks on a list of locations, you want the next screen to display details about that location without having to create a different screen for each location. Viewstacks allow you to create a series, or stack, of UI elements (Views) and then define the condition, or rule, that must be satisfied to display each View.
To create a Viewstack, right-click on a widget and choose “Add a view”. A viewstack is like a deck of cards, with only one View appearing at a time. You can use the Switch Views action or rules to control which view is displayed at any given time.
Below the Viewstack, each view is numbered so you can easily switch the current view.
Click the arrow to the right of the number indicators to specify a rule for each View. The following example, the View is determined based on a Variable called “location”.