Docs‎ > ‎Reactive Logic Tutorial‎ > ‎

No Empty Orders

Requirement: no Empty Orders

Since it makes no business sense to place an order with no line items, we implement the noEmptyOrder requirement using the following logic:

This example illustrates a number of concepts:

  1. Counts as existence checks - the itemCount indicates whether the order has any items
  2. Commit time validations - the validation is executed after item logic has adjusted the itemCount
  3. Constrain derived result
The last item bears some note.  As explained in Commit validations, using a "regular" validation would have the effect that all orders are rejected.  Since Commit Validations run after all the rows are processed, the itemCount will reflect the Lineitems (if any), so the logic will operate as intended.