This procedure computes the value of the on-hand inventory for each item. If the on-hand inventory is negative, the procedure sets the inventory value to 0.
r-mult.p
DEFINE VARIABLE inv-value AS DECIMAL NO-UNDO LABEL "VALUE".
FOR EACH Item NO-LOCK:
inv-value = Item.OnHand * Item.Price. IF inv-value < 0 THEN
inv-value = 0.
DISPLAY Item.ItemNum Item.ItemName Item.OnHand Item.Price inv-value.
END.
Note
Multiplying two decimal expressions produces a DECIMAL value. Multiplying two INTEGER expressions produces an INTEGER value. Multiplying two INT64 expressions produces an INT64 value. Multiplying an integer expression (INTEGER or INT64) and a decimal expression produces a DECIMAL value. Multiplying an INTEGER expression and an INT64 expression produces an INT64 value.