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.
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
).
The most important operators for writing scripts
Operator | Description | Example |
---|---|---|
Operator | Description | Examples |
---|
Operator | Description | Examples |
---|
+
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
| A "defined as equal to" operator assigns a value to a field or variable. |
|
| A semicolon ends a line. If you define variables (with |
|
| Double quotes highlight text, i.e., everything inside should be used as normal text. |
|
| Single quotes enclose table or field names that contain spaces or special characters so that Ninox detects they belong together. |
=> 425,00 € (VAT not included) Note: |
| A dot lets you access fields of records or values of JSON objects. | For example, access all customer IDs in the Customers table with ( |
| An alternative to double quotes (see above) is a 3 minus sign to help make dynamic text more clear. |
|
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)
| equal |
| not equal |
| less than |
| less than or equal to |
| greater than |
| greater than or equal to |
| contains |
1 + 1 = 3 - 1
Apples = Pears
Apples != Pears
1 + 1 != 3 - 1
4 * 2 < 10
10 < 4 * 2
5 * 2 <= 10
10 <= 4 * 2
10 > 4 * 2
4 * 2 > 10
5 * 2 >= 10
4 * 2 >= 10
"Hello" like "el"
"el" like "Hello"