No Empty Orders Example

No Empty Orders Example
lac31
Requirement:
No Empty Orders
Since it makes no business sense to place an order with no line items, the
noEmptyOrder
requirement is implemented using the following logic.
This example illustrates the following concepts:
  • Counts for existence checks. The
    itemCount
    indicates whether the order has any items.
  • Commit time logic. The validation is executed after item logic has adjusted the
    itemCount
    .
  • Constraint-derived result. Regular validations have the effect that all orders are rejected. Since commit validations run after all the rows are processed, the
    itemCount
     reflects the
    Lineitems
    (if any). The logic operates as intended.
For more information: