> For the complete documentation index, see [llms.txt](https://docs.amltd.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amltd.com/dc-works/applets/records-data-and-local-variables.md).

# Records, Data, and Local Variables

## Records, Data, and Local Variables

Records determine how an Applet receives, holds, displays, and processes information. They should be configured near the beginning of the Applet-building process, before fields, actions, and conditions depend on them.

An Applet can use:

* Records connected to database tables.
* Records populated through API calls.
* Local records created within the Applet.
* List records containing multiple entries.
* Local variables containing individual values.

### Understand Applet records

An Applet record is a working container for related values.

Fields can be bound to the properties of a record so that:

* User input is placed into the record.
* Retrieved information can be displayed.
* Actions can evaluate or modify its values.
* Conditions can use its values.
* Information can be passed between pages.

A record may correspond to a database table, but the record and the table are not the same thing.

{% hint style="warning" %}
Placing values into an Applet record does not automatically write them to a database table. An explicit action is required to add, append, update, or otherwise change table data.
{% endhint %}

### Open App Records

To manage the records used by an Applet:

1. Open the Applet in the **Applet Editor**.
2. Select **Records** from the left panel.

The **App Records** panel opens.

<figure><img src="/files/yT29M39im9qWNtQotPLH" alt=""><figcaption></figcaption></figure>

*The App Records panel contains the records and data sources available to the Applet.*

The panel includes the following sections:

| Section        | Purpose                                                             |
| -------------- | ------------------------------------------------------------------- |
| Table Records  | Creates working records connected to DC Works tables                |
| API Records    | Makes information from configured API calls available to the Applet |
| Custom Records | Creates records and values used locally within the Applet           |

Sections can be expanded or collapsed as needed.

### Table-based records

A table-based record uses the fields of a DC Works table as its structure.

It allows an Applet to work with values corresponding to that table’s fields. Depending on the Applet’s actions, the record may be used to:

* Collect values for a new table record.
* Hold a record retrieved from the table.
* Display several retrieved records.
* Prepare changes to an existing record.
* Supply values to actions and conditions.

To add a table-based record:

1. Open **App Records**.
2. Expand **Table Records**.
3. Select the database and table.
4. Select **Add Records**.
5. Define the required record and its purpose.
6. Give the record a clear name.

<figure><img src="/files/k2s5jDb0DxUCCBAbLI3k" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Zg9HNO4p5S25gDPgjoil" alt=""><figcaption></figcaption></figure>

*Table Records lists the Applet records connected to DC Works tables.*

More than one Applet record can use the same table. Each record can serve a different purpose within the workflow.

For example:

| Record purpose                  | Possible name |
| ------------------------------- | ------------- |
| Collect values for a new record | New Item      |
| Hold one selected table record  | Current Item  |
| Hold several retrieved records  | Items         |

These names are examples only. Applet records can be renamed to match the terminology of the process.

### A table connection does not automatically save data

A table-based record initially holds values within the Applet.

For example, fields may collect an identifier, location, date, condition, and notes into a record named **New Item**. Those values remain in the Applet until an action writes them to the table.

A typical sequence is:

1. The user enters information into fields.
2. Each field places its value into a property of **New Item**.
3. An **AddRecord** action adds the completed record to the table.
4. Additional actions may clear the fields and prepare the Applet for another entry.

Detailed field binding is covered in **Fields, Properties, and Data Binding**. Record actions are covered in **Actions, Events, and Conditions**.

### Single records and list records

A record can represent one set of values or a list containing multiple entries.

#### Single record

A single record holds one item at a time.

It is useful when the Applet must:

* Collect one new entry.
* Hold the currently selected item.
* Display or edit one retrieved record.
* Pass one group of related values between pages.

For example, a record named **Current Item** might hold the values from the row a user selected in a table view.

#### List record

A list record holds multiple entries.

It is useful when the Applet must:

* Display several table records.
* Process a collection of scanned items.
* Build a group of entries before continuing.
* Retrieve several matching records.
* Add or remove individual entries from a working collection.

A table-view field can use a list record to display multiple entries as rows.

{% hint style="info" %}
Use a single record when the Applet is working with one item. Use a list record when it must hold or display a collection of items.
{% endhint %}

### Local variables

A local variable holds one value used by the Applet.

Local variables are useful for values such as:

* A selected operation.
* A page or workflow state.
* A counter.
* A calculated total.
* A scanned identifier.
* A True/False indicator.
* A temporary message.
* A value used in a condition.

For example, a variable named **Selected Operation** might contain `Check Out` or `Return`. Conditions can then use that value to determine which page or actions should run.

Create local variables from the custom-data controls in the **App Records** panel. Give each variable a name that clearly describes its purpose.

<figure><img src="/files/SoFbgy3aNtLf1FVqIoDD" alt=""><figcaption></figcaption></figure>

*Local variables hold individual values used by fields, actions, and conditions.*

Use a local variable for one value. Use a local record when several related values need to be kept together.

### API records

API records make data returned through an API Connector available to the Applet.

To add an API record:

1. Expand **API Records**.
2. Select the configured API Connector.
3. Select **Add API Call**.
4. Add and name the required API record.

API Connector configuration is covered separately in **Integrations and API**.

### Name records and variables clearly

Record names appear throughout the Applet Editor when configuring fields, actions, and conditions.

Use names that describe the record’s role rather than generic names whose purpose may become unclear.

| Less descriptive | More descriptive    |
| ---------------- | ------------------- |
| Record 1         | New Inspection      |
| Current          | Selected Equipment  |
| Items            | Available Equipment |
| Value            | Selected Operation  |
| Flag             | Validation Passed   |

{% hint style="info" %}
A table-based record does not need to use the same name as its connected table. The record name should describe how the Applet uses it.
{% endhint %}

### Remove unused records

The trash icon beside an Applet record removes that record definition from the Applet.

Before removing a record, verify that it is not used by:

* Bound fields.
* Actions.
* Conditions.
* Page-load events.
* Table views.
* Other Applet logic.

Removing a record that is still referenced can interrupt the Applet’s workflow.

### Review the Applet’s records

Before creating and binding page fields, confirm that:

* Every required table has an appropriate Applet record.
* Single records and list records have been distinguished.
* Records used for new entries have been identified.
* Records used for selected or current items have been identified.
* Temporary grouped values use local records.
* Individual temporary values use local variables.
* Records and variables have clear names.
* Each record has a specific purpose.
* The actions required to load and write table data have been identified.

{% hint style="warning" %}
ecords are foundational to the Applet. Changing or removing them later may affect fields, actions, conditions, and pages that depend on them.
{% endhint %}

### Next

Continue to **Working with Pages** to create, organize, duplicate, copy, and configure the pages that make up the Applet’s user experience.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.amltd.com/dc-works/applets/records-data-and-local-variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
