USoft Rule Language Examples: Variable Constraint Messages

Previous Next

See Also

In USoft it is possible to use values from violating records in the constraint message that is presented to the end user. To make this possible, the columns from which these values are taken must be explicitly enumerated in the select-list of the constraint statement.

 

Unlike SQL syntax, the standard USoft Rule Language syntax is not suitable for expressing these values.

However, if the statement is USoft Rule Language then the constraint checker will attempt to resolve variables in the constraint message even though columns are not explicitly stated

 

If resolution is successful, the select-list items are generated into the select-list of the SQL equivalent.

If resolution of message variables in combination with a USoft Rule Language statement is NOT successful, then the constraint checker must throw a restrictive error message.

 

USoft Rule Language

SQL Equivalent

Message:

Message:

Customer with ID <d.id> cannot be a driver whilst having unpaid contract with code <c.code>.

Customer with ID <d.ID> cannot be a driver whilst having unpaid contract with code <c.code>.

Statement:

Statement:

FOR        drivers d

,        contracts c

,        "business parties" b

CONNECTED AS        

 b "PAYS FOR" c

DO NOT ALLOW THAT

 b.id = d.id

and        c.paid = 'N'

select        d.id, c.code

from        driver d

,        contract c

,        business_party b

relate        b "PAYS FOR" c

where        b.id = d.id

and        c.paid = 'N'