Create your own functions
function
Last updated
function
Last updated
Create your own functions with Ninox to automate workflows according to your needs.
write a script once and use it throughout the database
concise scripts because you only need your own function and don't have to insert the entire script once or even multiple times
To define a function, use function
followed by whatever name you choose. Then, in parentheses, specify which parameters are to be used. These are separated by commas.
parameterName : parameterType
To create a function without parameters, insert empty parentheses ()
.
Like scripts, the last line in the definition of the function is the return value.
To use your functions across the entire database, enter the function in the tab bar of the database under Options in Global functions.
Options are displayed when you're in edit mode .
Enable edit mode
Click the Options tab
Enter your function(s) under Global Functions.
Insert the function in a formula field of a table and that function is only available in that formula field. This is useful when keeping repetitive sections short, or when your function refers to the current table, respectively.
Let's create a function hello
to greet a person and tell them their age. First, pass the function a string for the name and a number for the age as parameters. These parameters are inserted into a given sentence at the appropriate positions.
Result: Hello Mom. You are 100 years old!
If you called the function like this: hello("Mom", 100)
name
text
age
number
Unfortunately, not all data types are currently supported by user-defined functions.
These following data types are already available for creating user-defined functions.
text
corresponds to the data type string
and stands for simple text
"Mom"
number
is a number
100
boolean
is either true or false
✅ "Mom" = "Mom"
⛔ "Mom" = "Dad"
date
is a date
date(1922, 1, 13)
time
is a time
time()
datetime
corresponds to the data type timestamp
and stands for a timestamp
datetime(date(1922, 1, 13), time())
Table name
corresponds to a record from the specified table
myRecord : 'Table 1'