Variable Constraint Messages: Example 6

Previous Next

EXAMPLE 6:

Suppose there is a PERCENTAGE domain, and a business rule that states: "All percentages must be rounded to the nearest multiple of 0.5". This business rule has been implemented by a domain constraint, of which the condition reads:

MOD(DOMAIN * 2, 1) != 0

And the correction reads:

ROUND(DOMAIN * 2) / 2

For this domain constraint, you may specify the message:

The <prompt> of this <objectName> has been rounded to the nearest multiple of 0.5

This will lead to an information message at run-time, for example:

"The Discount of this Person has been rounded to the nearest multiple of 0.5", or "The Group discount percentage of this Reservation has been rounded to the nearest multiple of 0.5".