AMT Help Files
homeLION Language ReferenceSyntaxOperators

Operators

Below, the possible operators are displayed in order of priority. The read order is always left to right.

Operator: Description:

()

Makes that the operation that is placed in between is executed first, before using its
result in another operation.

**

Takes the right value as exponent for the left value and calculates the result.

Use:

Operation:

Resulttype:

<Integer> ** <Integer>

<Integer>

<Integer> ** <Numeric>

<Numeric>

<Numeric> ** <Integer>

<Numeric>

<Numeric > ** <Numeric>

<Numeric>

Priority no:

1

Example:

r := v ** e
* Multiplies two operands.

Use:

Operation:

Resulttype:

See "**"

See "**"

Priority no:

2

Example:

r := a * b
/ Divides the left operand by the right operand.

Use:

Operation:

Resulttype:

See "**"

<Numeric>

Priority no:

2

Example:

r := a / b

MOD

Calculates the remainder (modulus) when the left operand is divided by the right operand.

Use:

Operation:

Resulttype:

See "**"

See "**"

Priority no:

2

Example:

r := a mod b
+

When using strings and/ or alphanumerics:
Concatenates the operands. If one of the operands is numeric, the dot (.) is omitted.

When using integers and/ or numerics for both operands:
Performs a count operation, the right value is added to the left value.

Please note that the following assignment:

a := a + b

can be abbreviated to:

a += b

This abbreviation is only supported if there is a single variable on either side of the + operator.
Abbreviating multiple variables and/or operators may lead to unexpected results. For example a := a + b / c should NOT be written as a += b / c

Please also note that when using multiple consecutive + signs in an expression, the expression will be evaluated from left to right (with the exception of the usage of parenthesis).
So when evaluating:

a := n1 + n2 + a + n1
where a is an alpha and n1 and n2 are numerics, the first + sign will lead to the addition of n1 and n2
and the second and third will lead to the concatenation of a and n1 as alpha.

Use:

Operation:

Resulttype:

<Alpha> + <Alpha>

<Alpha>

<Alpha> + <Integer>

<Alpha>

<Alpha> + <Numeric>

<Alpha>

<Alpha> + <String>

<Alpha>

<Integer> + <Alpha>

<Alpha>

<Integer> + <Integer>

<Integer>

<Integer> + <Numeric>

<Numeric>

<Integer> + <String>

<String>

<Numeric> + <Alpha>

<Alpha>

<Numeric> + <Integer>

<Numeric>

<Numeric> + <Numeric>

<Numeric>

<Numeric> + <String>

<String>

<String> + <Alpha>

<String>

<String> + <Integer>

<String>

<String> + <Numeric>

<String>

<String> + <String>

<String>

Priority no:

3

Example:
// Variables that are used in the examples below:
result   : alpha 20
result2  : numeric 10
v1       : numeric 2 value 11
v2       : numeric 5 value 12345
v3       : alpha 10 value 'abc'

(A)
result := v1 + '-' + v2
// Result will be get the value '11-12345'

(B)
result := v1 + v2
// Result will get the value '12356'

(C)
result := v1 + v2 & v1
// First addition and then concatenate
// Result will get the value '1235611'

(D)
result2 := v1 + v2
// Result2 will get the value 12356

(E)
result := notrunc(v3) + v1
// Result will get the value 'abc       11'
&

Concatenates the operands.

In contradiction with the function "+", no count operation will occur regardless of the data types.

If numerics, integers and/or booleans are used in these operations, these parameters
will be converted (before execution) as follows:

  • Numeric to Alpha (dots that are used for decimal values will be omitted)
  • Integer to String

Please note that the following assignment:

a := a & b

can be abbreviated to:

a &= b

Use:

Operation:

Resulttype:

<Alpha> & <Alpha>

<Alpha>

<Alpha> & <String>

<Alpha>

<String> & <Alpha>

<String>

<String> & <String>

<String>

Priority no:

3

Examples:
// Variables that are used in the examples below:
result   : alpha 20
result2  : numeric 10
v1       : numeric 2 value 11
v2       : numeric 5 value 12345
v3       : alpha 10 value 'abc'

(A)
result := v1 + '-' + v2
// Result will be get the value '11-12345'

(B)
result := v1 & v2
// Result will get the value '1112356'

(C)
result := v1 + v2 & v1
// First addition and then concatenate
// Result will get the value '1235611'

(D)
result2 := v1 & v2
// Result2 will get the value 1112356

(E)
result := notrunc(v3) & v1
// Result will get the value 'abc       11'
-

Subtracts the right value from the left value.

Please note that the following assignment:

a := a - b
can be abbreviated to:
a -= b

This abbreviation is only supported if there is a single variable on either side of the - operator.
Abbreviating multiple variables and/or operators may lead to unexpected results. For example a := a - b / c should NOT be written as a -= b / c

Use:

Operation:

Resulttype:

<Integer> - <Integer>

<Integer>

<Integer> - <Numeric>

<Numeric>

<Numeric> - <Integer>

<Numeric>

<Numeric> - <Numeric>

<Numeric>

Priority no:

3

Example:
c := b - a
= Evaluates "True" if the left and the right operand in a condition are equal.

Use:

Operation:

Resulttype:

<Alpha> = <Alpha>

<Boolean>

<Alpha> = <Integer>

<Alpha> = <Numeric>

<Alpha> = <String>

<Boolean> = <Boolean>

<Integer> = <Alpha>

<Integer> = <Integer>

<Integer> = <Numeric>

<Integer> = <String>

<Numeric> = <Alpha>

<Numeric> = <Integer>

<Numeric> = <Numeric>

<Numeric> = <String>

<String> = <Alpha>

<String> = <Integer>

<String> = <Numeric>

<String> = <String>

Priority no:

4

Examples:

(A)
if a = b
  gotoform ('FORM_X')
  exit
endif

(B)
if qt_buy.vendcode = null
  getvendorcode ()
endif
<>

Evaluates "True" if the left and right operand of a condition differ.

Use:

Operation:

Resulttype:

See "=".

See "=".

Priority no:

4

Example:
(A)
if a <> b
  gotoform ('FORM_X')
  exit
endif

(B)
if qt_buy.vendcode <> null
  getvendorcode ()
endif
<

Evaluates "True" if in a condition the left operand is lesser than the right operand.

Use:

Operation:

Resulttype:

See "=".

See "=".

Priority no:

4

Example:

if a < b
  gotoform ('FORM_X')
  exit
endif
> Evaluates "True" if the left operand is greater than the right operand of a condition.

Use:

Operation:

Resulttype:

See "=".

See "=".

Priority no:

4

Example:
if a > b
  gotoform ('FORM_X')
  exit
endif
<=

Evaluates "True" if the left operand is lesser than or equal to the right operand of a
condition.

Use:

Operation:

Resulttype:

See "=".

See "=".

Priority no:

4

Example:

if a <= b
  gotoform ('FORM_X')
  exit
endif
>=

Evaluates "True" if the left operand is greater than or equal to the right operand of a
condition.

Use:

Operation:

Resulttype:

See "=".

See "=".

Priority no:

4

Example:

if a >= b
  gotoform ('FORM_X')
  exit
endif
NOT

Results in the opposite of the unary operation.

Use:

Operation:

Resulttype:

NOT <Boolean>

<Boolean>

Priority no:

5

Example:

if not a
  gotoform ('FORM_X')
  exit
endif
AND

Evaluates "True" if both the left and the right condition evaluate "True".

Use:

Operation:

Resulttype:

<Boolean> AND <Boolean>

<Boolean>

Priority no:

6

Example:

if a <> b and c <> d
  gotoform ('FORM_X')
  exit
endif
OR

Evaluates "True" if the left or the right condition evaluate "True".

Use:

Operation:

Resulttype:

<Boolean> OR <Boolean>

<Boolean>

Priority no:

7

Example:

if a <> b or c <> d
  gotoform ('FORM_X')
  exit
endif
IN

Evaluates "True" if the value for <Item> is found in the [<Set>].

Use:

Operation:

Resulttype:

<Item> IN [ <Set> ]

<Boolean>

<Item>

Literal or single
variable (no
expression)

<Set>

<Item>|<Range> [,<Set>]may not be specified through a
variable.

<Range>

<Item>..<Item>

Priority no:

8

Examples:
(A)
if sn-6 in [1, 4, 9..12] then ....

(B)
b-found := sn-6 in [1, 4, 9..12]

(C)
qt_customer.where (qt_customer.city in ['Amsterdam', 'Leiden', 'Emmen'])

// be careful: the examples below are all incorrect!!

(D)
if (a + b) in [4, 6, 8] then ....
// not valid because (A+B) is an expression

(E)
if b in [ 4, 6, 8+9] then ....
// not valid because (8+9) is an expression

(F)
if b in [varesetitems] then ....
// not valid because it is not allowed to
// specify the <Set> through a variable
LIKE* Evaluates "True" if the left operand matches with the right operand, which may contain
wildcards.
Use:

Operation:

Resulttype:

<Operand> LIKE <Operand>)

<Boolean>

<Query handler>

Handler for executing
the table - or cursor
query.

<Operand>

Expression.

Priority no:

8

Example:
qtest.where (qtest.a5 like '%K')

*The LIKE operator is exclusively used in a WHERE clause for database transactions, in order to filter the requested data before it is sent by the database server.

Contents

 Go to top