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.
|n||A 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.
|D||The 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).|
|T||The 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).|
|@NB||The breakpoint level. The leading @ may be omitted.|
|@ND||The detail line counter. The leading @ may be omitted.|
|@NI||The item counter. The leading @ may be omitted.|
|@NS||The subvalue counter. The leading @ may be omitted.|
|@NV||The value counter. The leading @ may be omitted.|
Functions and Operators
|/||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.|
|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.|
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.