All product information in wiki.bizagi.com is only valid for Bizagi BPM Suite 9.1.X.
For newer Bizagi BPM Suite versions (10.X and up) please visit the User Guide.
 

Using id with XPath

From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS

Jump to: navigation, search


<keywords content="keywords"> add, element, elements, id, setXPath, ID </keywords>

Contents

Using "id" with XPath

When using XPath expressions it is not always clear where the "id" statement is needed. Here are two common mistakes.

Adding elements to a relation

This example is in a Loan Request Process, where there are several products for each request. The relationship is 1:N, that is, N products for 1 Request.


  • The 1 entity is called Request.
  • The N entity is called Products.
  • The Fact Name is Request_Products
  • Products has an attribute called Value


To add a new Loan product of US$1000, use the following statements:


DO ADD
Var NewProduct = Me.addRelation(“idRequest.Request_Products”);

NewProduct.setXPath(“Value”, 1000);


DO NOT ADD:

NewProduct.setXPath(“idRequest”,<idRequest.id>);


This last line damages the relationship: the statement that has the addRelation, creates it.


  • Related Topics: For further information about Adding elements to a relation, click here.

Using setXPath with "id"

Using the same example as above in a Loan Request Process, there are several clients for each request. There is a 1:N relationship, that is, N Clients for 1 Request. Each Client has a State in the process: they are either In Process, Approved or Rejected. As soon as the clients start the process, they should all have the 'In Process' State. So, the state will be set for each one.


  • The 1 entity is called Request.
  • The N entity is called Clients.
  • The Fact Name is Request_Clients
  • The Fact Parameter Entity is called Client_State


1. Obtain the 'In Process' state id, in order to set it for each client.





2. Iterate over the Request_Clients XPath, to set the State for each one.



3. Set the State for each on.


4. DO NOT use ".id" for setting the State. When you use the setXPath statement set the object, not the integer of the relation.


<comments />