Writing conditions

Top   Previous   Next

When creating a trigger you may define zero or more conditions that must be met in order for the trigger's actions to be executed.  The screen responsible for defining these conditions may be found in Step 2 of adding or editing a trigger. 

 

 

Figure 51

 

clip0051

 

Condition Tree - Binary expression tree which lists all conditions.  It has a root node with other internal nodes that are junctions (AND/OR statements) and leaf nodes that are constraints.

 

Condition -  Text representation of the condition tree along with interface for managing junctions and leaf node constraints.

 

Update - Updates condition tree.

 

Clear - Clears condition tree resulting in a single root node of true , indicating that this trigger will always evaluate to true and that all associated actions will be executed.

 

Test expression - Displays a "Test condition" dialog that allows you to enter actual values to test against your condition tree.

 

 

Sample condition

 

To demonstrate how you might create a condition we present a real-world example trigger that captures File Upload events and decrypts the file if the file uploaded contains .gpg or .pgp in the filename.

 

1.  Our first condition is to check whether the file was uploaded successfully.  Select the Success variable and set it's value to true

2.  Click the Update button.  The Condition Tree and Condition are updated accordingly.

3.  Our next condition is to check whether the filename contains .pgp OR .gpg .  Select the leaf node in the Condition Tree and then select the AND operator in the Condition.

4.  Click the Update button.  Your Condition Tree should now look the same as that in Figure 52.

 

Figure 52

 

clip0052

 

5.   Next, select the second leaf node in the Condition Tree and select the OR operator in the Condition.

6.   Click the Update button.  Your Condition Tree should now look the same as that in Figure 54

 

Figure 54

 

clip0054

 

7.  Highlight the first leaf node in the OR junction and change the variable to LocalPath , the constraint to CONTAINS and the value to .pgp

8.  Click the Update button.

9.  Highlight the second leaf node in the OR junction and change the variable to LocalPath , the constraint to CONTAINS and the value to .gpg

10.  Click the Update button to finish.  Your Condition Tree should now look the same as that in Figure 55.

11.  Click Next to define the PGP Decrypt action for this trigger.

 

Figure 55

 

clip0055