A.6 Complex Data Rules

A.6 Complex Data Rules

Table:

SOURCE

Description:

Source rows for a single part number cannot have two with the same priority.

Rule Logic:

(PART_NUMBER : PRIORITY) IS UNIQUE

  

Tables:

SOURCE, PURCHASE_ORDER

Description:

The quantity on a purchase order cannot be less than the minimum order quantity for the part.

Rule Logic:

PURCHASE_ORDER.QUANTITY <=SOURCE.MINIMUM_QUANTITY
AND PURCHASE_ORDER.PART_NUMBER =
SOURCE.PART_NUMBER

  

Tables:

PURCHASE_ORDER, INVENTORY

Description:

There should be no outstanding orders for parts that are marked Do not order.

Rule Logic:

(INVENTORY.PART_NUMBER =
PURCHASE_ORDER.PART_NUMBER) AND
(INVENTORY.DO_NOT_ORDER_FLAG = ‘D’) AND
(PURCHASE_ORDER.STATUS =
‘P’ OR PUCHASE_ORDER.STATUS !=‘S’)

Note:

I wrote this rule as a negative: it selects offenders. It is much easier to express it this way than to express it as a positive state.