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)
parameterName | parameterType |
---|---|
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.
Data type | Description | Example |
---|---|---|
| corresponds to the data type |
|
| is a number |
|
| is either true or false | |
| is a date |
|
| is a time |
|
| corresponds to the data type |
|
Table name | corresponds to a record from the specified table |
|
"Mom" = "Mom"
"Mom" = "Dad"