Returns the last stored value of a given attribute.
Old(Attribute)
Type Returned:
Same as its argument.
The Old function returns the last stored value of the specified attribute. The returned type matches the type definition of the attribute provided as an argument.
If the attribute is a non-redundant formula, the returned value is derived from the evaluation of the formula using the last stored values of the involved attributes.
Objects: Transaction
Generators: .NET, Java, Ruby, RPG, Visual FoxPro, Cobol
To simulate an ADD rule that updates the PrdStk (Product Stock) in a Receipt Transaction based on the RcptQty (Receipt Quantity), the following approach can be used:
// STOCK update (add simulation)
PrdStk = PrdStk + RcptQty IF Insert;
PrdStk = PrdStk + RcptQty - Old(RcptQty) IF Update;
PrdStk = PrdStk - RcptQty IF Delete;
Insert: Adds the received quantity of the product to the existing stock.
Update: Modifies the quantity by adding the new value and subtracting the previously stored one using the Old function.
Delete: Cancels the previous entry by subtracting the received quantity in cases of a returned delivery.
This is functionally equivalent to using the following ADD rule:
Add(RcptQty, PrdStk);