If Action

image\Action_Programming_If.jpg

The If action allows you to run a group of actions when the condition set in this action is met. You can set the condition to be either true or false. If the condition is set to true, the group of actions in an If action list will only play when the outcome of the action is true. Likewise, if the condition is set to false, the if action list will only play when the outcome of the action is false.

Important Note:

This is an example of a Conditional action – If you are unfamiliar with what a Conditional action does, please read Explaining Conditional actions before you read the rest of this section.

Setting up the If action:

  1. Add the If action to your trigger, as described in adding actions. The If tab will automatically appear when you add the action.

  2. Use the Test panel to set whether the group of actions in the If action list will play when the condition is true or false. Click on the down arrow to the right of the Test box to select one of the options available. By default, the Perform action if condition is TRUE option is selected – this is the most commonly used option.

Note:
This part of the action sets whether the outcome of this action needs to be true or false before the group of actions in the if action list will play.

You can select one of five possible options from the Test box. Whichever option you select can only produce one of two possible outcomes true or false. For a full explanation of the options available – see Test box options for more information. Also note, selecting any of the three bottom options for this box will change the options settings in the If action tab – this is explained in the Test box options topic.

  1. 3. Use the Name of variable to compare box to locate the variable that you want to compare. Click on the down arrow to the right of the box to open a list of all the variables in your current publication. Alternatively, click on the New… button to open the New Variable dialog box where you can create a new variable.

Note:
The variable entered in this box is compared with either: text, a number, or the contents of a different variable, see points 5 to 7 below for more information.

  1. Use the Comparison box to enter the type of comparison you want to make. Click on the down arrow to the right of the box to list all of the comparison types available. By default, the Is Equal option is selected – this is the most commonly used option.

Note:
See Comparison Types available for more information about the different types of comparisons available.

  1. Click the Text option if you want to compare the variable entered in point 2 above with text that you type in this Text box. By default, this option is selected.

Note:
You can type any amount of alphabetic or numeric characters in this box as you like. Please note, when comparing text, uppercase and lowercase letters are different e.g. Smith, SMITH and smith are not treated the same.

The comparison entered in the Comparison box (point 4 above) work on text as well – see Comparison Types available for more information.

  1. Click the Number option if you want to compare the variable entered in point 2 above with a number. Use the spin buttons to set a specific number.

Note:
The spin buttons will increase the number by a tenth e.g. 0.1, 0.2, 0.3 etc. You can type a number directly into the Number box if required.

  1. Click the Variable option if you want to compare the variable entered in point 2 above with the contents of a different variable in Opus. Click on the down arrow to the right of the box to list all of the variables in your current publication. Alternatively, click on the New… button to open the New Variable dialog box where you can create a new variable.

  2. Click on the Apply button to save your changes.

Note:
Creating If actions are an important part of any publication as they allow you to control the flow of your publication. This action may be difficult to understand when you first start but once you understand the concept it is easy to build and provides a greater flexibility to your publication. Nearly all publications will benefit from the use of the If action.

The Else action is often used in conjunction with the If action – see the Else action for more information.

Related Topics:

Understanding Conditional Actions

Conditional Test Options

Comparison Types Available

Introducing the Programming Actions

Choosing an Action