A-Correlatives |
![]() ![]() ![]() |
An A-correlative is an algebraic expression that applies operators to fields, constants and other data to produce a result. It is similar in concept to an I-type expression but very limited and often difficult to maintain.
The expression is prefixed by A and an optional semicolon.
Data items
Any of the above three data item types may be followed by R to indicate that the REUSE() function is to be applied to the data.
Functions and Operators
IF p THEN q ELSE r Returns q if p is true, r if p is false.
Examples
A;3*2 Multiplies the content of field 3 by the content of field 2.
A;(N(PRICE)+N(TAX))(MD2) Adds the PRICE and TAX fields. The result is then converted using an MD2 conversion code.
A;N(PRICE)*"1175"/"1000" Adds 17.5% tax to the single valued PRICE field. Note the need to perform the calculation in two steps because correlatives use integer arithmetic.
A;N(PRICE)*"1175"R/"1000"R Adds 17.5% tax to each value in the multivalued PRICE field. Note the use of the R qualifier on both constants in this expression.
A;DESCRIPTION["1","20"] Extracts the first 20 characters of the DESCRIPTION field.
A;IF N(QTY)<"10" THEN "Re-order" ELSE "" Returns "Re-order" if the QTY field is less than 10, otherwise returns a null string. |