### Presentation

In a certain number of screens in the parameterization, there is the possibility to enter calculation formulas, still called adonix expressions (the execution engine for the software using X3 technologies is in fact called adonix). These expressions are expressed in an algebraic format and form part of a general language. Below is given a general description of the functions that can be used in Adonix expressions.

Numerous aides exist during the entry of a formula, both to provide information on the available variables and functions but also to explain the significance of the formula. These aides are accessible by means of the formula editor.

It is possible to test an expression (in which only the accessible constants and variables for the context are available) using a calculator.

An ADONIX expression can be of the alphanumeric, numeric or date type. According to where the parameterization is carried out, it is possible to need on or other of these types (even if all the types can be used in a formula, the functions of a given type can call the arguments of another type). It should be noted that the type function is used to test the type of a variable.

### How to set up an ADONIX expression

An expression is made up of constants, operators, variables and functions.

#### Constants

The constants can be: alphanumeric : expressed either between apostrophes(') or inverted commas ("). Here are two examples of valid strings:

 "It's certain" 'a specific "string" ' numeric  : expressed with a decimal point if required. Here are two examples of valid numeric constants:

 -2.5 123000 date : expressed in the form [ day / month /year ]. It should be noted that it is mandatory to express the year on 4 figures. Here are two examples of valid date constants:

 [15/3/2002] [21/05/1819] logic type : these are bound up with the numeric constants: 1 (and by extension all non zero values) equivalent to True, 0 equivalent to False.

#### Operators

The following are the valid operators:

 + addition of two numbers, a date and a number of days, or the concatenation of two character strings. - subtraction of two numbers, a date and a number of days, or the concatenation of two character strings by inserting a space between the two strings. * multiplication of two numbers / division of two numbers ^ increase to the power of <<=>>=<> comparison operators andorxornot logical operators, that can also be abbreviated as&|?!

In addition, there is available the possibility to use brackets with an unlimited level of overlapping.

#### Variables

A variable is expressed in general fashion in the form of:

 [ class ] nomvar ( index )

For example, it is possible to define the following variables:

 [F:BPC]BPCNAME MA_VARIABLE ELEMENT(33)

The name of the nomvar variable is expressed in the form of letters and/or numbers, the first character always being a letter and the underline character can also be used. The significant length of a variable name is limited to 12 characters. All the names are authorised, with the exception of certain reserved key-words (File, Until, or Commit are examples of some of these key-words). When a variable name is entered using lower case letters, it is automatically transformed to uppercase letters, except if it is a key-word.

Certain variables can be dimensioned, that is to say they corresponds to the element tables (dimensions 1 to 4 are possible) In this case, one or more indexes is given in the form of numeric expressions, separated by commas (if there are more than one), between brackets (for example M_TB(1,2,8) is a valid syntax).

A class corresponds to a group of variables linked to a context. The most used classes are the following: [V] : global variable class. A variable of this type is linked to the ADONIX session. Once created, it remains accessible whilst it is not destroyed, or whilst the ADONIX session is not stopped. Its declaration is made with the help of dedicated instructions (according to its type, the Integer, Decimal, Char, Date, Label, Shortint, Float, Double instructions are used). [L] : Local variable class. It is linked to an overlapping of a sub-programmed (each Call instruction creates a new class of local variables which mask the previous class). The declaration of variables of this type is carried out in the same way as the previous variable type, but the declaration is preceded with the key-word Local. [C] : Sequence number type variables class. These are the variables common to all the levels of a folder. Their creation is made by a dedicated development function. [F:abv] or [abv] : this is the class of variables linked to a table declared by the File instruction. Within these are found the values of the current record. [M:abv] or [abv] : this is the class of variables linked to an entry screen declared with the Mask instruction. Found here are the values that have been entered or likely to be displayed (each tab in a screen is considered as a mask).

The class is not mandatory, because the rules make it possible to know the class by default.

There exist a number of system variables directly managed by Adonix. Whilst the other variables are transformed, during entry to uppercase, these variables that make up a part of the language key-words, are displayed in lower case. Here are a few of the system variables that can be used (not an exhaustive list):

 Name Type Definition nomap string current folder name datesyst date modifiable system date adxdir string Adonix root directory nolign numeric current line number fstat numeric return status after the read or posting to a table

#### Functions defined in the engine

A function expressed in the function form (list of arguments). A large number of functions exist: processing of character strings, date calculations, classic numeric functions, truncation and rounding functions, statistical functions....

A list of the principal functions that can be used in ADONIX is given below. In the functions grid, the write conventions are as follows: v is an argument for any type (the same for v1,v2,v3...) c is an argument for the character string type x is an argument for the numeric type n, p, q... are arguments for the integer type V is a variable list is a list of variables or expressions. In this list type, a TABLO variable of the grid type can be used in the form of TABLO(I) (only one index is used), TABLO (all the indexes are used) or TABLO(I..J) (the indexes I to J inclusive are used).

 Syntaxes Type Definition date\$ date current date sin(x), cos(x), tan(x) numeric trigonometric functions asin(x),acos(x)... numeric inverse trigonometric functions log(x),exp(x),ln(x) numeric logarithmic functions abs(x), sgn(x) numeric absolute value, sign ar2(x), arr(x,y) numeric round to 2 decimals, round to x - y int(x), mod(x,y) numeric integer part, modulo len(c) numeric length of a string day(d),month(d),year(d) numeric extraction of day, month, year for a date dayn(d),week(d) numeric day number in the week, week number num\$(x) string convert a number to a string (decimal representation) space\$(n), chr\$(n) string string composed of n spaces, with 1 character with the internal code n string\$(n,c), string\$(n,x) string string made of of n characters with the code c(or n character with the code x) day\$(d), month\$(d) string day name, month name addmonth(d,n) date the date d where a month n has been added eomonth(d) date the last day of the month corresponding to the date d left\$(c,n), right\$(c,n) string right/left section of a string made up of n characters mid\$(c,n,p), seg\$(c,n,p) string extraction of sub-strings for a given string gdat\$(n,p,q) date construction of a date (n=day, p=month, q=year) pat(c1,c2) numeric verify the conformity of a string c1 to a template c2 (1 if it conforms, 0 if not). The template can include the wild-card characters * (any number of any characters), ? (any character), # (any number). min(list), max(list) all types minimum or maximum for a group of variables or values sum(list), prd(list) numeric sum, product of a group of variables or values avg(list), var(list) numeric average, variance for a group of variables or values sum(list) string concatenation of a group of string variables or values uni(list) numeric verification of uniqueness for a group of variables or values find(v,list) numeric search for a value of any type in a list evalue(c) all types evaluation of a character string containing an expression format\$(c,v) string formatting of a value with a given format c. toupper(c),tolower(c) string transformation in lower case, upper case sigma(V=v1,v2,v3) numeric sum (V variant V1 to V2), of the v3 expression of the function of V

#### Functions defined by the developers

There also exist functions defined by developers and these can be used in calculation expressions, using the following syntax:

func TRAIT.FUNCT(list of arguments)

PROC being the name of the process and FUNCT being the name of the function concerned. It should be noted that the functions that can be used are documented in the sub-programme table.