Validation Rule examples

Validation Rules are sets of Boolean expressions that enable the Map Engine to check the content of a Business Document in DML during message processing.

Validation Rule expression Explanation

!Port of Embarkation! = "Le Havre"

This Validation Rule checks the value that is contained in the Port of Embarkation node.

If the Business Document does not contain the value Le Havre in the Port of Embarkation node, the Business Document is rejected.

The node name is enclosed inside exclamation marks ( ! ).

(!Port of Embarkation! = "Le Havre") and (!Port of Debarkation! = "Brest") and (!Dock Time! > 2)

This Validation Rule checks the values that are contained in three nodes: Port of Embarkation, Port of Debarkation, and Dock Time.

If the Business Document does not contain the values that are specified for all three nodes, the Business Document is rejected.

%varZ:=1;

%varB:=true;

loop (count(Dock Time))

{

if Dock Time [%varZ] >= 2 then %varB:= false;

%varZ := %varZ + 1

};

%varB

This Validation Rule checks the value in the Dock Time node:

  • The DML function count returns every occurrence of Dock Time in the Business Document.
  • The DML instruction loop repeats the Validation Rule for each occurrence of Dock Time.
  • The Variable varB returns the value of the Validation Rule (true or false).

If the Business Document does not contain a value that is greater than or equal to 2 (hours) in the Dock Time node, the Business Document is rejected.

Related topics

Business Documents

Use Business Document Validation Rules

Related Links