Boolean
A value of True or False. With the method bool() you can interpret an input as a boolean value.
Every number except the 0 is interpreted as true. Any string other than a representation of true (e.g. "True", "TrUe", "true") is interpreted as false. Empty lists or objects are interpreted as false and lists or objects with at least one item/entry as true.
input_param = 1
bool(#input_param)
true
| input_param | type | bool(#input_param) |
|---|---|---|
| "" | empty string | false |
| -1 | number | true |
| 0 | number | false |
| 1 | number | true |
| TrUe | string | true |
| True | string | true |
| [1] | list | true |
| [] | empty list | false |
| [false] | boolean list | true |
| false | boolean | false |
| false | string | false |
| true | boolean | true |
| true | string | true |
| tuer | string | false |
Date
A date object represents a date (year, month and day). You can use date(str) to create a date object from a string using auto-detection or you can use date(str, format) to get the date from an arbitrary format. Format parameter is a string containing Format Tokens.
Following methods can use dates:
The following formats are guaranteed to work with auto-detection:
| Format code | Example | Description |
|---|---|---|
| YYYY-MM-DD | 2018-07-15 | ISO 8601 date |
| YYYY-MM-DDTHH:mmZ | 2018-07-15T14:48+0200 | ISO 8601 datetime with timezone |
| YYYY-MM-DD HH:mm | 2018-07-15 14:48 | ISO 8601-like (not a standard) |
| DD.MM.YYYY | 15.07.2018 | German numeric date |
| DD.MM.YYYY HH:mm | 15.07.2018 14:48 | German datetime |
| DD.MM.YYYY HH:mm Z | 15.07.2018 14:48 +0200 | German datetime with timezone |
| X | 1531658880 | Unix timestamp (seconds since 1970) |
WARNING
For all other formats, we highly recommended to specify the format string, as there can be cases where it fails for some dates but not others. In particular, US-style dates ("07/15/2019") will not work when the day number is below 12.
input_param = "06.04.2019"
date(#input_param)
<date 2019-04-06>
input_param = "2019/06/12"
date(#input_param)
<date 2019-12-06>
input_param = "2019/06/12"
date(#input_param, "YYYY/MM/dd")
<date 2019-06-12>
Please note that when using the date() function, the time component is explicitly discarded; it will be assumed as 0:00 UTC if needed. To supply a date and time value with timezone, please pass an ISO-8601 datetime string as documented above directly to date_convert()/date_add().
| input_param | format | Date object | Notes |
|---|---|---|---|
| 05/06/2019 | MM/DD/YYYY | <date 2019-05-06> | US-style date |
| 05-06-2019 | DD-MM-YYYY | <date 2019-06-05> | British English |
| 2019.5.6 | YYYY.M.D | <date 2019-05-06> | Japanese style date notation |
| 5.6.2019 | D.M.YYYY | <date 2019-06-05> | German style |
| 05.06.2019 | DD.MM.YYYY | <date 2019-06-05> | German style with 0-padding |
Decimal
A positive or negative number or zero. Also called a real number. A Decimal can be any negative or positive number with approximately 300 digits.
Use the method numeric() to try to interpret an input parameter as a real number.
input_param = "1,2"
numeric(#input_param)
1.2
WARNING
The output uses the dot notation.
input_param = "abc"
numeric(#input_param)
Could not convert "abc" of type "str" to type Decimal".
input_param = "1,23a"
numeric(#input_param)
Could not convert "1,23a" of type "str" to type "Decimal".
| input_param | numeric(#input_param) | |
|---|---|---|
| "" | 0 | |
| "-0" | 0 | |
| .0 | 0 | |
| ".0" | 0 | |
| "0" | 0 | |
| "1" | 1 | |
| "1.0" | 1 | trailing zeros are removed |
| 1 | 1 | |
| 1. | 1 | |
| "1." | 1 | |
| 1.0 | 1 | |
| "1,2" | 1.2 | |
| "1.2" | 1.2 | |
| "1,0.5" | 10.5 | |
| "1.0,5" | 10.5 | |
| "1,000.5" | 1000.5 | |
| "1.000,5" | 1000.5 | |
| "1e" | 1 | |
| "1e+" | 1 | |
| "1e+1" | 10 | |
| "1e+2" | 100 | |
| "1e+3" | 1000 | |
| "1e1" | 10 | |
| "1e2" | 100 | |
| "1e+15" | 1000000000000000 | |
| "1e+16" | "1E+16" | representation changes |
| 1111111111111111 | 1111111111111111 | |
| 11111111111111111 | "11111111111111111" | representation changes |
| 9999999999999999 | 10000000000000000 | loss of precision |
| 99999999999999999 | "99999999999999999" | representation changes |
| 9999999999999999999999999999 | "9999999999999999999999999999" | |
| 99999999999999999999999999999 | "1E+29" | loss of precision |
Integer
A positive or negative number or zero. Also called a whole number.
You can use the method int() to interpret a Node input as an integer.
input_param = "1"
int(#input_param)
1
WARNING
Example string "1" (data type: string) was interpreted as an integer.
input_param = "abc"
int(#input_param)
Could not convert "abc" of type "str" to type "int".
input_param = "123a"
int(#input_param)
Could not convert "123a" of type "str" to type "int".
| input_param | int(#input_param) | |
|---|---|---|
| "" | 0 | empty string |
| "-0" | 0 | |
| .0 | 0 | |
| 0. | 0 | |
| "0" | 0 | |
| "1" | 1 | |
| 1 | 1 | |
| 1. | 1 | |
| 1.0 | 1 | |
| 1.1 | 1 | |
| "1.1" | error | use int(numeric(#input_param)) |
| 1111111111111111 | 1111111111111111 | |
| 11111111111111111 | 11111111111111112 | /!\ |
| 111111111111111111 | 111111111111111100 | /!\ |
| 1111111111111111111 | 1111111111111111200 | /!\ |
List
List represents a data structure that can contain indexed elements of different values (e.g. integer), reference types (e.g. string) or objects.
Use [ and ]-brackets to construct a list or to access a list element.
Method list() tries to interpret a constructed list as a list.
Construct a list
input_param1 = "abc"
input_param2 = "xyz"
[#input_param1, #input_param2]
["abc","xyz"]
input_param1 = {"dummykey":"dummyvalue"}
input_param2 = "1a3"
input_param3 = 42
[#input_param1, #input_param2, #input_param3]
[{"dummykey":"dummyvalue"},"1a3",42]
WARNING
#input_param1 is an object, #input_param2 is a string and #input_param3 is an integer.
Accessing an element in a list
input_param = ["string1", "string2"]
#input_param[1]
"string2"
input_param1 = ["string1", "string2"]
#input_param1[0]
"string1"
WARNING
The integer between the square brackets represents the index of a list. The first element of a list has the index 0 (e.g. #param1[0]).
Assuming l is [#p1,#p2,#p3,#p4], then l[index] is:
| index | element | |
|---|---|---|
| 0 | #p1 | 0 is first element |
| 3 | #p4 | |
| 4 | "" | 4 would be 5th element, which does not exist |
| -1 | #p4 | -1 is last element |
| -2 | #p3 | -2 second to last element |
| -3 | #p2 | |
| -4 | #p1 | |
| -5 | "" | would go beyond first element, which does not exist |
Object
An Object represents a data structure that contains a set of string keys to values pairs.
Examples:
{"ExampleKey1": "ExampleValue"}{"ExampleKey1": 123456, "ExampleKey2": ["string", 12345]}{"ExampleKey1": {"ExampleKey1": ["string", 12345], "ExampleKey2": ["string", 12345] }}
Use { and }-brackets to construct an object.
list() converts an object to a sequence of [key, value] pairs; object() does the reverse. Together with filter() and map() this can be used to modify objects.
Construct an object
#input_param = [["Brand", "Xiaomi"], ["Model", "Mi Mix"]]
object(#input_param)
{"Brand":"Xiaomi", "Model":"Mi Mix"}
Get a value from an object
To access a value from a single of multiple objects use the following methods:
WARNING
It is necessary to bundle the object or objects in a list before accessing them.
String
A string represents a sequence of zero ("") or more Unicode characters ("abc.....").
You can use the method str() to interpret an input parameter as a string object.
input_param = 123
str(#input_param)
"123"
WARNING
Example integer 123 (data type: integer) could be interpreted as a string "123".