Top  Previous  Next


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. Where the expression consists only of an IF element, the leading A; can be omitted.



Data items


nA field number. This field is extracted from the current record


N(name)A field name. This name is looked up in the dictionary when the correlative is compiled and run time code generated to extract the field from the current record. QM extends the capabilities of this function compared to other multivalue products by allowing name to be a reference to another calculated item (I-type, C-type or correlative).


"string"A constant. All constants, including numeric values, must be enclosed in single quotes, double quotes or backslashes.


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.


DThe internal date. This is the actual date at the point when the function is executed, not a reference to the @DATE variable (which does not change during a command).


TThe internal time. This is the actual time at the point when the function is executed, not a reference to the @TIME variable (which does not change during a command).


@NBThe breakpoint level. The leading @ may be omitted.


@NDThe detail line counter.  The leading @ may be omitted.


@NIThe item counter.  The leading @ may be omitted.


@NSThe subvalue counter.  The leading @ may be omitted.


@NVThe value counter.  The leading @ may be omitted.



Functions and Operators


+Adds operands


-Subtracts operands


*Multiplies operands


/Divides operands. Note that this is an integer division.


=Relational equality test.


# or <>Relational inequality test.


>Relational greater than test.


<Relational less than test.


>=Relational greater than or equal to test.


<=Relational less than or equal to test.


p[q,r]Returns a substring of p starting at character q, r characters long.


R(p,q)Returns the remainder from dividing p by q.


S(p)Returns the sum of all the values in multivalued item p.


IF p {THEN q} {ELSE r}
Returns q if p is True, r if p is False. Absent elements return a null string.


(conv)Applies the given conversion code to the expression value. Note that conv is not quoted.


ANDLogical AND


ORLogical OR.






Multiplies the content of field 3 by the content of field 2.



Adds the PRICE and TAX fields. The result is then converted using an MD2 conversion code.



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.



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.



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.