The most important operators for writing scripts
Operator | Description | Examples |
---|---|---|
Create simple arithmetic operations
These operators let you take 2 numeric values, perform a calculation, and return a numeric value. This is mainly about basic arithmetic operations.
Operator | Description | Example |
---|---|---|
Ninox removes
superfluous parentheses—following the precedence rule "first the division, then the addition")—and
superfluous white spaces.
However, Ninox also adds white spaces where they are deemed useful, e.g., for better readability).
Two values are compared with each other
This allows you to compare 2 numeric values. The operators return a result that is either true or false. The output in the Ninox field is Yes (true
) or No (false
).
Operator | Description | Examples |
---|
:=
A "defined as equal to" operator assigns a value to a field or variable.
Text := "Hello world!"
let x := 1000;
x := 2
;
A semicolon ends a line. If you define variables (with let
), the semicolon is also inserted automatically and subsequently by Ninox.
let x := 1000;
""
Double quotes highlight text, i.e., everything inside should be used as normal text.
"Hello" + " " + "world!"
=> Hello world!
Text := "Hello world!"
=> Hello world!
''
Single quotes enclose table or field names that contain spaces or special characters so that Ninox detects they belong together.
'Total net' + " " + "(VAT not included)"
=> 425,00 € (VAT not included)
Note: 'Total net'
is a field name in your database.
"(VAT not included)"
is text appended to the amount.
.
A dot lets you access fields of records or values of JSON objects.
For example, access all customer IDs in the Customers table with (select Customers).CustomerIDs
.
--- ---
An alternative to double quotes (see above) is a 3 minus sign to help make dynamic text more clear.
---Hello world!---
=> Hello world!
+
Addition (also for joining text)
1 + 2 = 3
-
Subtraction
3 - 2 = 1
*
Multiplication
2 * 3 = 6
/
Division
6 / 3 = 2
%
Modulo
13 % 5 = 3
(13 / 5 = 2 Reminder 3)
()
Parentheses (to change the order in which expressions are processed)
1 + 2 * 3 = 1 + (2 * 3) = 7
(1 + 2) * 3 = 9
| equal | |
| not equal | |
| less than | |
| less than or equal to | |
| greater than | |
| greater than or equal to | |
| contains | |
Make texts dynamic via a script
To personalize texts, for example, send a letter that looks basically the same as an invoice to many recipients with the respective other data, this is easier to do with dynamic texts (see birthday greetings).
To make texts dynamic using a script, you have 2 options:
Connect simple strings and fields with the plus operator +
.
Template strings with values inside braces {...}
.
Concatenate simple strings with the +
operator. Use +
to include any data type, e.g., numbers.
At least one of the data types must be a string, so that the output is also a string.
In a table, create a First Name field and paste the following content into a formula field.
Result: Hello Sam! (if the First name field contains the value Sam)
Template strings are indicated by a 3 minus signs ---
at the beginning and end. Everything in between turns into text.
Put braces {...}
around scripts, e.g., to write a serial letter that fetches the relevant data, such as first and last name, address, etc., from a table.
Same as above, but with a template string.
Result: Hello Sam! (if the First name field contains the value Sam)