# Functions library

Find documented Ninox functions fast in one A–Z reference. Use this page for quick lookup.

Use [Work with functions](/ninox-scripting/automate-your-workflows/work-with-functions.md) to explore functions by category.

Jump to: [A](/ninox-scripting/functions-and-script-library/functions-library.md#a) · [C](/ninox-scripting/functions-and-script-library/functions-library.md#c) · [D](/ninox-scripting/functions-and-script-library/functions-library.md#d) · [E](/ninox-scripting/functions-and-script-library/functions-library.md#e) · [F](/ninox-scripting/functions-and-script-library/functions-library.md#f) · [G](/ninox-scripting/functions-and-script-library/functions-library.md#g) · [H](/ninox-scripting/functions-and-script-library/functions-library.md#h) · [I](/ninox-scripting/functions-and-script-library/functions-library.md#i) · [J](/ninox-scripting/functions-and-script-library/functions-library.md#j) · [L](/ninox-scripting/functions-and-script-library/functions-library.md#l) · [M](/ninox-scripting/functions-and-script-library/functions-library.md#m) · [N](/ninox-scripting/functions-and-script-library/functions-library.md#n) · [O](/ninox-scripting/functions-and-script-library/functions-library.md#o) · [P](/ninox-scripting/functions-and-script-library/functions-library.md#p) · [Q](/ninox-scripting/functions-and-script-library/functions-library.md#q) · [R](/ninox-scripting/functions-and-script-library/functions-library.md#r) · [S](/ninox-scripting/functions-and-script-library/functions-library.md#s) · [T](/ninox-scripting/functions-and-script-library/functions-library.md#t) · [U](/ninox-scripting/functions-and-script-library/functions-library.md#u) · [W](/ninox-scripting/functions-and-script-library/functions-library.md#w) · [Y](/ninox-scripting/functions-and-script-library/functions-library.md#y)

## **A**

### abs()

Return the absolute value of a number.\
`abs(number)`

* `number` the value to convert

***

### acos()

Return the arccosine of a value between `-1` and `1`.\
`acos(number)`

* `number` the cosine value

***

### age()

Return the number of full years since a date.\
`age(date)`

* `date` the reference date

***

### alert()

Show a simple message with an OK button.\
`alert(any)`

* `any` the message or value to show

***

### appointment()

Create an appointment from start and end, or from start and duration.\
`appointment(any, any)`

* `any` first argument: start or end value
* `any` second argument: end value or duration

***

### array()

Merge two arrays into one array.\
`array([any], [any])`

* `[any]` first array
* `[any]` second array

***

### asin()

Return the arcsine of a value between `-1` and `1`.\
`asin(number)`

* `number` the sine value

***

### atan()

Return the arctangent of a number.\
`atan(number)`

* `number` the value or quotient

***

### atan2()

Return the arctangent of one value divided by another.\
`atan2(number, number)`

* `number` first argument: numerator
* `number` second argument: denominator

***

### avg()

Return the average of numeric values.\
`avg([number])`

* `[number]` an array or numeric field list

***

## **C**

### capitalize()

Capitalize the first letter of each word.\
`capitalize(string)`

* `string` the text to convert

***

### ceil()

Round a number up to the next integer.\
`ceil(number)`

* `number` the value to round

***

### chosen()

Return selected values from a multiple choice field, or check whether a value is selected.\
`chosen(multi)`, `chosen(multi, string)`, `chosen(multi, number)`, `chosen(multi, [number])`

* `multi` a multiple choice field
* `string` a label to check
* `number` an option ID
* `[number]` several option IDs

***

### clientLang()

Return the current client language code.\
`clientLang()`

***

### cnt()

Count non-empty items in a list or selection. This is the short form of `count`.\
`cnt([any])`

* `[any]` the list or selection to count

***

### color()

Return a color value.\
`color(name)`, `color(r, g, b)`, `color(r, g, b, a)`, `color(choice)`

* `name` a color name or hex code
* `r, g, b` RGB values
* `a` opacity
* `choice` a choice field with colors

***

### concat()

Return one comma-separated text string.\
`concat([any])` or `concat(value1, value2, ...)`

* `[any]` an array, selection, or multiple choice field
* `value1, value2, ...` values to combine

***

### contains()

Check whether text or a list contains an exact value.\
`contains(string, string)` or `contains([any], any)`

* `string` the text to search; second argument the value to find
* `[any]` the array to search; second argument the array to find

***

### cos()

Return the cosine of an angle in radians.\
`cos(number)`

* `number` the angle in radians

***

### count()

Count non-empty items in a list or selection.\
`count([any])`

* `[any]` the list or selection to count

***

## **D**

### date()

Create a date, or strip the time part from a time-based value.\
`date(any)` or `date(year, month, day)`

* `any` a date, datetime, or Unix milliseconds
* `year`, `month`, `day` the date parts

***

### datetime()

Create a local timestamp.\
`datetime(milliseconds)`, `datetime(year, month, day[, hour[, minute[, second[, millisecond]]]])`, or `datetime(date, time)`

* `milliseconds` Unix time in milliseconds
* date and time parts the local timestamp values
* `date`, `time` separate date and time values

***

### day()

Return the day of the month.\
`day(date)`, `day(timestamp)`, `day(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date

***

### days()

Return the number of calendar days between two dates.\
`days(date, date)`

* first argument start date; second argument end date

***

### degrees()

Convert radians to degrees.\
`degrees(number)`

* `number` the angle in radians

***

### dialog()

Show a dialog and return the selected answer.\
`dialog(string, string, [string])`

* first argument title
* second argument message
* third argument answer options

***

### duplicate()

Create a copy of a record.\
`duplicate(record)`

* `record` the record to copy

***

### duration()

Return a time span from an appointment or between two values.\
`duration(appointment)` or `duration(end, start)`

* `appointment` the appointment to measure
* `end`, `start` the later and earlier values

***

## **E**

### email()

Return an email value from another value.\
`email(any)`

* `any` the value to convert

***

### endof()

Return the end of an appointment or a calendar period.\
`endof(appointment)` or `endof(date, period)`

* `appointment` the appointment value
* `date` the reference date
* `period` a period such as `"month"` or `"week"`

***

### even()

Check whether a number is even.\
`even(number)`

* `number` the value to test

***

### exp()

Return `e` raised to a power.\
`exp(number)`

* `number` the exponent

***

### extractx()

Extract the first regex match from text.\
`extractx(string, string)`, `extractx(string, string, string)`, `extractx(string, string, string, string)`

* first argument the source text
* second argument the regex pattern
* third argument optional flags
* fourth argument optional capture expression such as `$1`

***

## **F**

### fieldId()

Return the internal ID of a field.\
`fieldId(field)`, `fieldId(record, string)`, `fieldId(string, string)`

* `field` the field itself
* `record` a record from the table
* `string` field name, or table name and field name

***

### file()

Return one file reference.\
`file(any)` or `file(nid, string)`

* `any` a file field or supported file source
* `nid` the record with the attachment
* `string` the exact filename

***

### files()

Return several file references as an array.\
`files(any)` or `files(nid)`

* `any` a file field or supported file source
* `nid` the record with the attachments

***

### first()

Return the first item from a list or selection.\
`first([any])`

* `[any]` the list or selection

***

### floor()

Round a number down to the next integer.\
`floor(number)`

* `number` the value to round

***

### format()

Convert numbers, dates, times, and appointments to text with a format pattern.\
`format(number, pattern)`, `format(date, pattern[, language])`, `format(time, pattern)`, `format(timestamp, pattern[, language])`, `format(appointment, pattern[, language])`

* first argument the value to format
* `pattern` the format expression
* `language` optional language code

***

### formatJSON()

Convert a JSON object to a JSON string.\
`formatJSON(JSON)`

* `JSON` the object to convert

***

### formatXML()

Convert a JSON object to XML text.\
`formatXML(JSON)` or `formatXML(JSON, boolean)`

* `JSON` the object to convert
* `boolean` whether to pretty-print the output

***

## **G**

### get()

Read a field by name, or read a stored key-value entry.\
`get(record, string)` or `get(string)`

* `record` the record to read from
* `string` the field name, field ID, or storage key

***

## **H**

### html()

Return a rich text value with HTML rendering.\
`html(any)`

* `any` the value or HTML string to render

***

### http()

Send an HTTP request.\
`http(string, string)`, `http(string, string, JSON)`, `http(string, string, JSON, any)`, `http(string, string, JSON, [file])`, `http(string, string, JSON, any, [file])`

* first argument HTTP method such as `"GET"` or `"POST"`
* second argument target URL
* `JSON` optional headers
* `any` optional body
* `[file]` optional uploaded files

***

## **I**

### icon()

Return an icon value.\
`icon(choice)` or `icon(string)`

* `choice` a choice field with an icon
* `string` the icon name

***

### index()

Return the position of the first match in text or an array.\
`index(text, search)` or `index([any], any)`

* first argument the text or array to search
* second argument the value to find

***

### isAdminMode()

Check whether the client UI is in admin mode.\
`isAdminMode()`

***

### isDatabaseLocked()

Check whether edit mode is currently locked.\
`isDatabaseLocked()`

***

### isDatabaseProtected()

Check whether edit mode requires a password.\
`isDatabaseProtected()`

***

### item()

Return one item from a list or one value from a JSON object.\
`item([any], number)`, `item(JSON, number)`, `item(JSON, string)`

* `[any]` the list or selection
* `number` zero-based position or numeric JSON key
* `string` JSON key

***

## **J**

### join()

Combine text values into one string with a custom separator.\
`join([string], string)`

* `[string]` the list of text values
* `string` the separator

***

## **L**

### last()

Return the last item from a list or selection.\
`last([any])`

* `[any]` the list or selection

***

### length()

Count characters in text or items in a list.\
`length(string)` or `length([any])`

* `string` the text to count
* `[any]` the array to count

***

### ln()

Return the natural logarithm of a number.\
`ln(number)`

* `number` the input value

***

### location()

Create a location value from a title and coordinates.\
`location(string, number, number)`

* `string` the location title
* second argument latitude
* third argument longitude

***

### log()

Return a logarithm with base `10` or another base.\
`log(number)` or `log(number, number)`

* first argument the input value
* second argument optional base

***

### lower()

Convert text to lowercase.\
`lower(string)`

* `string` the text to convert

***

### lpad()

Pad text on the left to a fixed length.\
`lpad(string, length, padding)`

* `string` the source text
* `length` the target length
* `padding` the padding characters

***

## **M**

### max()

Return the highest number or latest date-like value.\
`max([any])`

* `[any]` the comparable values

***

### min()

Return the lowest number or earliest date-like value.\
`min([any])`

* `[any]` the comparable values

***

### month()

Return the month number from `1` to `12`.\
`month(date)`, `month(timestamp)`, `month(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date

***

## **N**

### ninoxApp()

Return the current app or client context.\
`ninoxApp()`

***

### now()

Return the current date and time.\
`now()`

***

### number()

Convert a value to a number.\
`number(any)`

* `any` the value to convert

***

### numbers()

Return selected IDs from a multiple choice field.\
`numbers(multi)` or `numbers(dmulti)`

* `multi` a multiple choice field
* `dmulti` a dynamic multiple choice field

***

## **O**

### odd()

Check whether a number is odd.\
`odd(number)`

* `number` the value to test

***

## **P**

### parseCSV()

Convert CSV text into rows and columns.\
`parseCSV(string, options)`

* `string` the CSV text
* `options` optional settings such as `firstLineIsHeader`, `separator`, and `textQuote`

***

### parseJSON()

Convert a JSON string to a JSON object.\
`parseJSON(string)`

* `string` the JSON text

***

### parseXML()

Convert an XML string to a JSON object.\
`parseXML(string)`

* `string` the XML text

***

### pow()

Raise a number to a power.\
`pow(base, exponent)`

* `base` the starting number
* `exponent` the power to apply

***

## **Q**

### quarter()

Return the quarter number from `1` to `4`.\
`quarter(date)`

* `date` a date value, or a timestamp or datetime value

***

## **R**

### radians()

Convert degrees to radians.\
`radians(number)`

* `number` the angle in degrees

***

### random()

Return a random number between `0` and `1`.\
`random()`

***

### range()

Build an array of consecutive numbers.\
`range(to)`, `range(from, to)`, `range(from, to, step)`

* `from` optional start value
* `to` stop value
* `step` optional increment

***

### raw()

Return the internal raw text representation of a value.\
`raw(any)`

* `any` the value to inspect

***

### record()

Return a record reference from a table and numeric record ID.\
`record(table, id)`

* `table` the table that contains the record
* `id` the numeric record ID

***

### removeItem()

Remove one key-value pair from a JSON object.\
`removeItem(JSON, string)`

* `JSON` the object to change
* `string` the key to remove

***

### replace()

Replace each exact match of one string with another.\
`replace(text, search, replacement)`

* `text` the source text
* `search` the text to find
* `replacement` the text to insert

***

### replacex()

Replace text with a regular expression.\
`replacex(text, pattern, replacement)` or `replacex(text, pattern, flags, replacement)`

* `text` the source text
* `pattern` the regex pattern
* `flags` optional regex flags
* `replacement` the replacement text

***

### round()

Round a number to an integer or decimal place.\
`round(number)` or `round(number, digits)`

* `number` the value to round
* `digits` optional number of decimal places

***

### rpad()

Pad text on the right to a fixed length.\
`rpad(string, length, padding)`

* `string` the source text
* `length` the target length
* `padding` the padding characters

***

### rsort()

Sort values in descending order.\
`rsort([any])`, `rsort(any, any, ...)`, `rsort([any], [any], ...)`

* arguments values or arrays of the same type

***

## **S**

### set()

Update a field by name or field ID.\
`set(record, string, any)`

* `record` the record to update
* `string` the field name or field ID
* `any` the new value

***

### setItem()

Add or update one key-value pair in a JSON object.\
`setItem(JSON, string, any)`

* `JSON` the object to change
* `string` the key to update
* `any` the new value

***

### sign()

Return whether a number is negative or non-negative.\
`sign(number)`

* `number` the value to check

***

### sin()

Return the sine of an angle.\
`sin(number)`

* `number` the angle value

***

### sleep()

Pause a script for a number of milliseconds.\
`sleep(number)`

* `number` the delay in milliseconds

***

### slice()

Return part of a list or part of a string.\
`slice([any], from, to)` or `slice(string, from, to)`

* first argument the list or text to slice
* `from` inclusive start position
* `to` exclusive end position

***

### sort()

Sort values in ascending order.\
`sort([any])`, `sort(any, any, ...)`, `sort([any], [any], ...)`

* arguments values or arrays of the same type

***

### split()

Split text into parts at each exact separator.\
`split(text, separator)`

* `text` the source text
* `separator` the split marker

***

### splitx()

Split text into parts with a regex pattern.\
`splitx(text, pattern)`

* `text` the source text
* `pattern` the regex split pattern

***

### sqr()

Square a number.\
`sqr(number)`

* `number` the value to square

***

### sqrt()

Return the square root of a number.\
`sqrt(number)`

* `number` the input value

***

### start()

Return the start timestamp of an appointment.\
`start(appointment)`

* `appointment` the appointment value

***

### string()

Convert a value to its raw string form.\
`string(value)`

* `value` the value to convert

***

### styled()

Return styled text with optional colors and an icon.\
`styled(text, background)`, `styled(text, background, icon)`, `styled(text, background, fontColor, icon)`, `styled(text, JSON)`

* `text` the text to show
* `background` background color
* `fontColor` text color
* `icon` icon name
* `JSON` style definition

***

### substr()

Return part of a string from a start position.\
`substr(text, start)` or `substr(text, start, length)`

* `text` the source text
* `start` zero-based start position
* `length` optional number of characters

***

### substring()

Return part of a string between two positions.\
`substring(text, start, end)`

* `text` the source text
* `start` zero-based start position
* `end` exclusive end position

***

### sum()

Add numeric values together.\
`sum([number])`

* `[number]` an array or numeric field list

***

## **T**

### tableId()

Return the internal ID of a table.\
`tableId(table)`, `tableId(record)`, `tableId(string)`

* `table` the table itself
* `record` a record from the table
* `string` the table name

***

### tan()

Return the tangent of an angle.\
`tan(number)`

* `number` the angle value

***

### testx()

Check whether text matches a regular expression.\
`testx(string, string)` or `testx(string, string, string)`

* first argument the source text
* second argument the regex pattern
* third argument optional flags

***

### text()

Convert a value to readable text.\
`text(value)`

* `value` the value to convert

***

### time()

Return the current time, extract a time, or create a time value.\
`time()`, `time(any)`, `time(hour, minute)`, `time(hour, minute, second)`, `time(hour, minute, second, millisecond)`

* `any` a time-based value or Unix milliseconds
* time parts hour, minute, second, and millisecond

***

### timeinterval()

Create a duration offset.\
`timeinterval(any)` or `timeinterval(number, unit)`

* `any` a time-related value or milliseconds
* `number` the amount
* `unit` a unit such as `"hours"` or `"days"`

***

### timestamp()

Convert a time-related value to a UTC-based timestamp.\
`timestamp(any)`

* `any` a date-like value or Unix milliseconds

***

### today()

Return the current date without a time part.\
`today()`

***

### trim()

Remove spaces at the start and end of a string.\
`trim(string)`

* `string` the text to clean

***

## **U**

### unique()

Remove duplicate values from one or more arrays.\
`unique([any])` or `unique([any], [any], ...)`

* `[any]` the arrays to combine and deduplicate

***

### upper()

Convert text to uppercase.\
`upper(string)`

* `string` the text to convert

***

### url()

Return a link value from text or query data.\
`url(any)` or `url(any, JSON)`

* `any` the source value
* `JSON` optional query parameters

***

### urlDecode()

Decode URL-encoded text.\
`urlDecode(string)`

* `string` the encoded text

***

### urlEncode()

Encode text for safe use in a URL.\
`urlEncode(string)`

* `string` the text to encode

***

### user()

Return the current user, or look up a workspace user by name.\
`user()` or `user(string)`

* `string` the user name to look up

***

### userEmail()

Return the current user’s email, or another user’s email.\
`userEmail()` or `userEmail(user)`

* `user` optional user value

***

### userFirstName()

Return the first name of the current or given user.\
`userFirstName()` or `userFirstName(user)`

* `user` optional user value

***

### userFullName()

Return the full name of the current or given user.\
`userFullName()` or `userFullName(user)`

* `user` optional user value

***

### userHasRole()

Check whether a user has a role.\
`userHasRole(string)` or `userHasRole(user, string)`

* `string` the role name
* `user` optional user value to check

***

### userId()

Return the internal ID of the current or given user.\
`userId()` or `userId(user)`

* `user` optional user value

***

### userIsAdmin()

Check whether the current user is an admin.\
`userIsAdmin()`

* none

***

### userLastName()

Return the last name of the current or given user.\
`userLastName()` or `userLastName(user)`

* `user` optional user value

***

### userName()

Return the display name of the current or given user.\
`userName()` or `userName(user)`

* `user` optional user value

***

### userRole()

Return the primary role of the current or given user.\
`userRole()` or `userRole(user)`

* `user` optional user value

***

### userRoles()

Return all roles of the current or given user.\
`userRoles()` or `userRoles(user)`

* `user` optional user value

***

### users()

Return all collaborators in the current workspace.\
`users()`

***

## **W**

### week()

Return the calendar week number.\
`week(date)`, `week(timestamp)`, `week(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date

***

### weekday()

Return the weekday number from `0` to `6`.\
`weekday(date)`, `weekday(timestamp)`, `weekday(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date

***

### workdays()

Return the number of business days between two dates.\
`workdays(start, end)`

* `start` start date
* `end` end date

***

## **Y**

### year()

Return the year number.\
`year(date)`, `year(timestamp)`, `year(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date

***

### yearmonth()

Return year-month like `2026/03`.\
`yearmonth(date)`, `yearmonth(timestamp)`, `yearmonth(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date for the `YYYY/MM` label

***

### yearquarter()

Return year-quarter like `2026 Q1`.\
`yearquarter(date)`, `yearquarter(timestamp)`, `yearquarter(datetime)`, `yearquarter(appointment)`

* `date` a date value
* `timestamp` a UTC-based timestamp value
* `datetime` a local datetime value
* `appointment` an appointment value; Ninox uses the start date for the `YYYY Qn` label

***

### yearweek()

Return year-week like `2026 12`.\
`yearweek(date)`, `yearweek(timestamp)`, `yearweek(appointment)`

* `date` a date value
* `timestamp` a timestamp or datetime value
* `appointment` an appointment value; Ninox uses the start date for the `YYYY WW` label

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ninox.com/ninox-scripting/functions-and-script-library/functions-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
