# How to Create an Association Between Tables in Custom Data?

An association between tables allows selecting data from one table in another. This is useful when you need to create a relationship between different entities (for example, tasks and priorities, products and categories).

---

## When Needed

- You need to select values from one table when creating a record in another.
- You need to create a "one-to-many" relationship between tables.
- You need to organize structured data with links between tables.

---

## What's Important to Know

- **Association** — field type that allows creating links between different data models.
- Association type "one-to-many" means that one record from one table can be linked to many records in another.
- When editing a record, values from the associated table will be available in the dropdown list.
- The field that will be displayed after the association is selected from the associated model.

---

## Prerequisites

- [x] You are logged in with integrator or administrator rights.
- [x] There are two created Custom Data models in the system (the one in which the association is created, and the one from which data is taken).
- [x] You have navigated to the `Custom Data` module via `Apps -> Custom Data`.

---

## Step-by-Step Instructions

1. In the `Custom Data` module, go to the **"Create/Update"** tab.
2. Open the model in which you need to make a selection from another table (for example, "Tasks").
3. Add a new field or edit an existing one.
4. Select field type **"Association"** (ASSOCIATION).
5. Configure association parameters:
   - **Association Type** — select "one-to-many"
   - **Model to take data from** — select the model from the list (for example, "Priorities")
   - **Field to display** — select a field from the associated model that will be shown in the dropdown list (for example, "priority_name")
6. Save changes in the model.

---

## Usage Example

If you have a "Priorities" table with fields "priority_id" and "priority_name", and in the "Tasks" table you need to select a priority:

1. Open the "Tasks" model.
2. Add an "Association" type field.
3. Configure:
   - Model: "Priorities"
   - Field for display: "priority_name"
4. Save the model.

After this, when editing a record in the "Tasks" table, values from the "Priorities" table will be available in the dropdown list (for example, "High", "Medium", "Low").

---

## What Happens After

After creating the association, the "Association" type field is displayed in the model. When creating or editing a record, values from the associated table will be available in the dropdown list. The selected value is saved as a link to the record in the associated table.

---

## How to Verify It Worked

- Check that the "Association" type field is added to the model.
- Make sure the correct model and field for display are selected.
- Create a test record and check that values from the associated table are displayed in the dropdown list.
- Check that the selected value is saved correctly.

---

## Related Materials

- [Create model](/en/customdata/how-to/create-model.md)
- [Configure field type](/en/customdata/how-to/configure-field-type.md)
- [Add field to model](/en/customdata/how-to/add-field-to-model.md)

