Xpath Definitions

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Policies > Vocabulary >

Xpath Definitions

Xpath Definitions represent expressions that obtain values from the business data model and update them as well. In contrast to the Constants definitions the Xpath Definitions must be associated to a Process or Application.

 

These definitions are meant to be used when defining Policies; therefore, when created, their name should be as clear as possible to be easily understood.

 

XPath Definitions can be related to single attributes or to collections. When related to single attributes, the Definitions can be used to get or set values. Collections can be used to get values, using functions.

 

Available functions to be applied are:

 

Sum: Returns the sum of numbers or currency fields of the collection.

Count: Returns the number of records found in the selected collection.

Minimum value: Returns the smallest number, currency or date of the collection.

Maximum value: Returns the largest number, currency or date of the collection.

Average: Returns the average of specific numbers or currency fields of the collection.

Empty: Returns TRUE if the collection is empty, or FALSE if it is not.

Exists: Returns TRUE if an attribute with a condition is found in the collection.

 

For further information please refer to XPath Functions

 

How to create XPath Definitions

1. When the New Definition is selected a new window is displayed to name the XPath. The name must be self-explanatory because these Definitions will be used when Expressions and Policies rules are configured.

 

 

XpathDefinitions5

 

2. The window to select the Xpath from the data model is displayed. Click Next when the attribute has been selected.

 

XpathDefinitions6

 

 

3. In the next window select the destination use for the new Definition. If the XPath definition will be used to assign values on the associated attribute select Set a value, otherwise, if the Xpath definition will be used to obtain the attribute’s current value select Get a value.

 

Click Finish after selecting the corresponding option.

 

XpathDefinitions7

 

The Xpath definition has been created.

 

 

How to create XPath Definitions related to Collections

1. When the New Definition is selected (see the Vocabulary section) a new window is displayed to name the XPath. The name must be self-explanatory because these Definitions will be used when Expressions and Policies rules are configured.

 

 

XpathDefinitions1

 

 

2. The window to select the Xpath from the data model is displayed. Click Next when the attribute has been selected.

 

XpathDefinitions2

 

 

3. Select the Function to apply to the records contained in the selected attribute.

 

 

XpathDefinitions3

 

 

4. In the next window you are able to select whether this Definition will be used to get or set a value.

However; since we selected an attribute in a collection and as collections are used to get values, the only permissible use will be to get a value.

Click Finish to create the XPath Definition.

 

 

XpathDefinitions4

 

 

 

 

How to filter collection XPath Definitions

The records of the collection Definition can be filtered with different conditions. These conditions are specified when selecting the XPath.

You can define if all (AND operator) or some (OR operator) of the conditions included must be fulfilled. The default option is the AND operator.

 

XpathDefinitions8

 

To include multiple conditions click Add filter condition. A new row is inserted in the table. ; the following information must be entered in the table.

 

Left Operator: the attribute to be evaluated in the condition.

Operator: Select the operator for the condition.

Right operator: constant value or attribute to complete the condition.

 

The following table shows the different operators available according to the Attribute type of the Left operator.

 

Attributes

Operators

Numerical attributes

Equal, Different, Less Than, Less Than or Equal, Greater Than, Greater Than or Equal

Text attributes

Equal, Different

 

Click the 'X' icon located on the right side of the condition to delete it if necessary. A window to confirm the deletion will be displayed.

 

 

XpathDefinitions9

 

All the records of the relation are retrieved if no filter is specified.

 

How to Edit/ Delete Xpaths Definitions

1. Access the Vocabulary option from the Processes Module or the Application Module where the Definition was created. Identify the XPath Definition and right-click it.

Select the Edit Definition or Delete Definition option according to the required action.

 

XpathDefinitions10

 

 

If you selected the Edit option, the Definition editor will be opened. Follow the same steps explained to create the Definition, except for naming it.

 

If you selected the Delete option,  a confirmation screen will be displayed when selecting this option. Click Yes to delete the definition.

 

 

XpathDefinitions11

 

Definitions that are in use by a Policy cannot be deleted.