fieldId

To return the ID of a field

This function retrieves the internal identifier of a specified field. A field represents a location stored within a row of a table in a database. Each field is defined by an ID, a name, and a field type. Field IDs are capital letters starting with "A," "B," ..., "AA," "AB," etc.

Syntax

fieldId(nid, string)

fieldId(string, string)

Return

string

Benefit of fieldId

  • No direct UI references in scripts: This function allows you to work with field IDs rather than field names, so your scripts aren't tied to specific UI elements. This is helpful if field names change over time.

Use cases for fieldId

  • Calculations without the field name: You can use fieldId to do calculations or work with data without needing to know the exact field name, making your scripts more flexible.

  • Populate a row with JSON objects: You can use fieldId to easily fill a row with data from JSON objects, making data entry and management simpler.

Examples

  1. Use fieldId(nid, fieldName) to retrieve the field ID using the current table's record ID (nid) and the field name:

fieldId(this, "Name")

Result: D

This is the field ID for the field named "Name" in the current table.

  1. Use fieldId(tableName, fieldName) to retrieve the field ID using the table name and field name:

fieldId("Customer", "Name")

Result: A

This is the field ID for the field named "Name" in the "Customer" table.

  1. Use fieldId(fieldName) to retrieve the field ID using the field name:

fieldId(Number)

Return: D

The field ID for the field named "Number" in the current table.

See also

tableId which returns the ID of a table.

databaseId which returns the ID of a database.

teamId which returns the ID of the current workspace.

Last updated