Click or drag to resize

Alchemy Operators

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release

Alchemy builds on a limited subset of the SQL syntax. All statements are case-insensitive. This section describes the operators (arithmetic, boolean and ternary) available for use in a Alchemy script and the order of precedence when using multiple expressions.

Comments

Alchemy uses standard C-style comments:

Alchemy
/* This is a comment */
Arguments

Arguments may be passed to an Alchemy script from the command line. These arguments may be referenced from inside your Alchemy script using the $args array:

Alchemy
PRINT "This script file located at: " + $args[0];
PRINT "This script file was given " + length($args) + " arguments.";
Note Note

The $args array is equivalent to the argv array in C. The first argument is the path to the Alchemy script, the remaining arguments are those passed to the script from the command line.

Arithmetic Operators
OperatorDescriptionExample

+

Addition

1 + 1 = 2

-

Subtraction

3 - 1 = 2

*

Multiplication

2 * 1 = 2

/

Division, path.combine

Division: 4 / 2 = 2

system.io.path.combine: "C:\temp" / "data.dbf" produces "C:\temp\data.dbf"

%

Modulo: Remainder operator

5 % 3 = 2

Boolean Operators

Operator

Description

Example that returns true

OR

Logical Or: true if one or both of its arguments are true

true OR false

true OR true

AND

Logical And: true if both of its arguments are true

true AND true

NOT

Logical Not: true if its argument is false

NOT false

IN

Logical In: true if its left argument is included amongst its right arguments

"A" IN ("A", "B", "C")

<

Less Than: true if its left argument is smaller than its right argument

1 < 2

>

Greater Than: true if its left argument is larger than its right argument

2 > 1

<=

Less Than Or Equal To: true if its left argument is the same size or smaller than its right argument

1 <= 2

2 <= 2

>=

Greater Than Or Equal To: true if its left argument is the same size or larger than its right argument

2 >= 1

2 >= 2

=

==

Equal To: returns true if both of its arguments are identical

1 * 5 = 5

(1 + 2) == (4 - 1)

!=

<>

Not Equal To: returns true if its arguments are not identical

(1 + 1) != 3

"left" <> "right"

Ternary Operator

Symbol

Syntax

Explanation

?

expr ? result_true : result_false;

The logical expression, expr, is evaluated. If expr is true then result_true is performed. Otherwise, if expr is false, result_false is performed.

result_true and result_false can be any data type or even separate logic expressions.

The function of the ternary operator in Alchemy is identical to its functionality in C.

Order of Precedence

Operators are executed according to their value in the following precedence table: operators with the lowest value will be executed first, while operators with the highest value will be executed last. If an expression contains two or more operators with the same order of execution the rightmost operation in the expression will be executed first.

Operators

( )

* / %

+ -

< > <= >= != <> = == IN

NOT

AND

OR

?

Order of Execution

1

2

3

4

5

6

7

8