Logical operators compare expressions and return a boolean value, depending on which operator is used
Description of the method
Description: |
Logical operators compare expressions and return a boolean value, depending on which operator is used expr1 and expr2: Returns true, when both expressions are true expr1 or expr2: Returns true, when at least one expression is true expr1 xor expr2: Returns true, when exactly one expression is true not(expr): Returns the opposite of whichever expr is |
Available for: |
base64binary, boolean, datetime, double/decimal, date, hexBinary, integer, string, double/decimal and integer |
Parameters: | - |
Return type: | boolean |
Example1
Context: | TransactionType1 |
OCL: |
self.Amount > 200 implies self.Debtor.Name->size() = 1 and self.Creditor.Name->size() = 1 |
Description: | The example rule mandates the usage of both Creditor and Debtor name when Amount exceeds 200 |
The XML snippet below would pass this check.
<Transaction>
<Id>203</Id>
<Amount>201</Amount>
<Debtor>
<Name>Debtor2</Name>
</Debtor>
<Creditor>
<Name>Creditor2</Name>
</Creditor>
</Transaction>
<Transaction>
<Transaction>
<Id>203</Id>
<Amount>1</Amount>
<Creditor>
<Name>Creditor2</Name>
</Creditor>
</Transaction>
<Transaction>
The other snippet below however would not pass this check as the value is different from "IdContent".
<Transaction>
<Id>203</Id>
<Amount>201</Amount>
<Creditor>
<Name>Creditor2</Name>
</Creditor>
</Transaction>
<Transaction>
Please note that in order to make the feedback for user as accurate as possible, this exact rule may be divided into two separate rules. The individual rules would be:
if Amt exceeds 200, then Creditor Name is mandatory
if Amt exceeds 200, then Debtor Name is mandatory
This way error report will always point out the erroneous case, as the query and error message for each rule can be different.