Running Actions Conditionally

You can run an action conditionally based on a variable or expression. For example, actions run when you open Print Preview for a document. However, you might not want the actions to run in Print Preview. In this case, you can use the IsPrintPreview or IsPrinting global variable to prevent an action from running when the document is not actually sent to the printer.

To run an action conditionally, configure the condition on the Action tab for the action, as follows.

ClosedTo run an action conditionally based on a variable

Use this option when only one condition determines whether the action runs.

  1. On the Action tab for the selected action, click to select Conditionally, based on variable.

  2. In the variable name field, click , and then click More Variables to open the Insert Variable dialog.

  3. In the left navigation pane, click the category of the variable that you want.

  4. In the variable list, select the variable that you want, and then click OK. Alternatively, double-click the variable.

  5. On the Action tab, click the relational operator to display a list of additional operators, and then click the one that you want to use. For more information, refer to Relational Operators.

  6. When the relational operator requires a value to be specified, the <enter a value> field is displayed. Click this field, and then enter the value that you want.

  7. In the type list, select Text or Decimal to specify whether the conditional statement is evaluating a text or decimal value.

For example, when you want to use the IsPrintPreview variable to specify that an action is not run when you open the document in Print Preview, follow these steps:

  1. On the Action tab for the selected action, click to select Conditionally, based on variable.

  2. In the variable name field, click , and then click More Variables to open the Insert Variable dialog.

  3. In the left navigation pane, click Global.

  4. In the variable list, select IsPrintPreview, and then click OK. Alternatively, double-click the variable.

  5. On the Action tab, click the relational operator, and then click Equals.

  6. In the <enter a value> field, enter false.

  7. In the type list, select Text.

ClosedTo run an action conditionally based on an expression

Use this option when more than one condition determines whether the action runs.

  1. On the Action tab for the selected action, click to select Conditionally, based on expression.

  2. To change the existing conditional joiner (by default, this is And), click the joiner in the Tree View tab, and then click the joiner that you want.

  3. To add a conditional joiner, click .

  4. In the variable name field, click , and then click More Variables to open the Insert Variable dialog.

  5. In the left navigation pane, click the category of the variable that you want.

  6. In the variable list, select the variable that you want, and then click OK. Alternatively, double-click the variable.

  7. On the Action tab, click the relational operator to display a list of additional operators, and then click the one that you want to use. For more information, refer to Relational Operators.

  8. When the relational operator requires a value to be specified, the <enter a value> field is displayed. Click this field, and then enter the value that you want.

  9. In the type list, select Text or Decimal to specify whether the conditional statement is evaluating a text or decimal value.

Related Topics