Xpath Functions: Exists Remove Distinct values Index of
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords">exists, exist,</keywords>
Contents |
XPath Functions
The following examples will use the following syntax. In the data model the Process Entity is: ProcessEntity.
This entity can be related with other entities until reaching a one-to-many relationship.
<ProcessEntityAttribute.….AttributeN.FactName[Filter]>
- ProcessEntityAttribute.….AttributeN: the Xpath starting with the Process Entity, until reaching the one-to-many entity.
- FactName: Name of the one-to-many relationship. This entity has a collection of records.
- Filter: Condition to be met in the collection.
- AttributeName: Name of the attribute in the 'many' entity, which should be a numeric attribute.
Exists
This function returns true when the collection has at least one entry.
<exists(ProcessEntityAttribute.….AttributeN.FactName)>
Example: Let’s verify whether or not there are any Documents in the Request <exists(Request.Request_DocumentReq)> |
To verify whether there are any entries that meet a condition, without using variables in the condition.
<exists(ProcessEntityAttribute.….AttributeN.FactName[Filter])>
Example: let’s verify whether or not there are any documents pending receipt. <exists(idRequest.Request_DocumentReq[!bRecieived)> Remember that the Received field is Boolean. To know whether or not the field is false, use the expression: !bReceived. |
To verify whether or not there are any entries that meet a condition, using variables in the condition.
Me.getXPath(“exists(ProcessEntityAttribute.….AttributeN.FactName[Filter= "+FilterVble+"])”)
FilterVble: Condition to be met using variables.
Example: Let’s verify whether or not there are any Documents with today’s Date. Me.getXPath("exists(idRequest.Request_DocumentReq[bDate = "+DateTime.Now+"])") |
Example: In the Loan Request process, when the Client presents co-signers, the process flow should enter the Person Evaluation module where the information of each co-signer is verified along with whether or not he/she is on any of the blacklists. |
<span id="remove" />
Remove
This function is used to delete an entry that belongs to a relation.
<remove(ProcessEntityAttribute.….AttributeN.FactName, position)>;'
Position: Number indicating the position of the entry you want to delete. It does not receive variables or attributes, just numeric values.
Example: Delete the first entry of the Documents requested. <Remove(Request.Request_DocumentReq,0)> |
Delete an entry indicating the position with a variable
Me.getXPath(“remove(ProcessEntityAttribute.….AttributeN.FactName, “ + vble + )”);
vble: Variable that contains the number of the position of the entry you want to delete.
Example: Delete the last entry of the Documents requested. var last = <count((Request.Request_DocumentReq)> -1; Me.getXPath(“Remove(Request.Request_DocumentReq,”+ last+”)”) |
<span id="distinct_values" />
Distinct Values
This function allows us to get a collection of values of an attribute, without repeated values. You have to indicate the variable for which the values will not be repeated.
<distinct-values(ProcessEntityAttribute.….AttributeN.FactName.AttributeName)>
AttributeName: Name of the attribute for which values will not be repeated.
Example: Get the loans that have a different Term <distinct-values(Request.Request_ LoanReq.iTerm)> |
How to get a collection without repeated entries from the entries that meet a condition, without using variables in the condition.
<distinct-values(ProcessEntityAttribute.….AttributeN.FactName[Filter].AttributeName)>
AttributeName: Name of the Attribute for which the values will not be repeated.
Example: Get the different types of loans requested, that have been Approved. Assume that the Status entity is not Administrable and the idStatus for Approved is 1. <distinctvalues(Request.Request_LoanReq [Status.id=1].LoanType.NameLoanType)> |
How to get a collection without repeated entries, from the entries that meet a condition, using variables in the condition.
Me.getXPath(“distinct-values(ProcessEntityAttribute.….AttributeN.FactName[FilterVble].AttributeName)”)
AttributeName: Name of the Attribute for which the values will not be repeated.
Example: To obtain the values of the Loan whose value is greater to the preapproved value of the client. var Pre-approvedValue = <Request.cPre-approvedValue>; Me.getXPath(“distinct-values(Request.Request_LoanReq[cValueRequested > “ + Pre-approvedValue + “].cValueRequested”)> |
<span id="index_of" />
Index of
When you use this function, you can get an entry position number, by specifying the value that an attribute in the collection is going to take.
This function returns a collection of positions
<index-of(ProcessEntityAttribute.….AttributeN.FactName.AttributeName, Value)>;
Value: Value taken by the attribute specified in the XPath expression. It is a fixed value, it cannot be a variable value.
Example: Get the positions of the Loan Requests whose Term is: <index-of(Request.Request_LoanReq.iTerm,24)>; |
To get the positions of the entries that meet a position, using variable values
Me.getXPath(“index-of(idPVAttribute1,….idAttributeN.FACTNAME.AttributeName, “+ ValueVble +)”);
ValueVble= Value taken by the attribute specified in the XPath expression, which can be a variable.
Example: Get the positions of the loans whose value is equal to the Pre-approved Value. var Value = <Request.cPre-approvedValue>; Me.getXPath(“index-of(Request.Request_LoanReq.cValueRequested,“+ Value+ ”)”); |
<comments />