# MultiSelect

The **MultiSelect** field is an input component that allows users to **select multiple values** from a dynamically retrieved list.\
Unlike **Checkbox**, which is typically UI‑focused, the MultiSelect field is designed to support **persistent multi‑value data storage**, often using a **separate relational (mapping) table**.

This field is especially useful for **many‑to‑many relationships** between entities.

***

### Purpose of MultiSelect Field

The MultiSelect field is designed to:

* Allow selection of **multiple values** from a dynamic data source
* Persist multiple selections in a separate destination table
* Support relational data modeling (parent–child / many‑to‑many)
* Reduce UI complexity compared to large checkbox groups

#### Typical Use Cases

* User assigned to multiple roles
* Product assigned to multiple categories
* Permissions or tags selection
* Skill sets, features, or attributes selection

***

### Adding and Configuring a MultiSelect Field

To add a MultiSelect field:

1. Drag the **MultiSelect** field into a Module layout
2. Click the **Edit (pencil) icon** on the field
3. The **MultiSelect Configuration** window opens

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FNKkhUPOrvS9KTmcmjQmu%2Fimage.png?alt=media&#x26;token=890ef80b-4585-42ad-a1a6-74a7e10af782" alt=""><figcaption></figcaption></figure>

***

### MultiSelect Configuration Properties

#### 1️. Core Identification

| Property  | Mandatory | Description                        |
| --------- | --------- | ---------------------------------- |
| **MF ID** | Yes       | System‑generated unique identifier |

***

#### 2️. Field Behavior

| Property          | Description                                                      |
| ----------------- | ---------------------------------------------------------------- |
| **Default Value** | Initial selected values (if any)                                 |
| **Source Tag**    | JavaScript injected at field level (e.g. `readonly`, `onchange`) |

***

#### 3️. Data Source Definition

These properties define where the selectable data is retrieved from.

| Property         | Mandatory | Description                             |
| ---------------- | --------- | --------------------------------------- |
| **Table Name**   | Yes       | Source table for selectable values      |
| **Column Show**  | Yes       | Column displayed to the user            |
| **Column Value** | Yes       | Column stored as selected value         |
| **Condition**    | No        | SQL condition to filter selectable data |
| **Alt Desc**     | No        | Alternate description field             |

***

#### 4️. Multi‑Value Persistence (Mapping Table)

These settings control how selected values are stored.

| Property                 | Description                                  |
| ------------------------ | -------------------------------------------- |
| **Destination Table**    | Table used to store multiple selected values |
| **Parent Key**           | Foreign key referencing the parent entity    |
| **MultiSelect List Key** | Column that stores selected values           |

> This design allows MultiSelect to model **many‑to‑many relationships** correctly.

***

#### 5️. Database Mapping (Main Entity)

| Property      | Description                                           |
| ------------- | ----------------------------------------------------- |
| **Field\_ID** | Database field mapped to this component (if required) |

***

#### 6️. Display & Search Configuration

| Property              | Description                                              |
| --------------------- | -------------------------------------------------------- |
| **ShowFieldName**     | Label displayed on the screen (auto‑generated supported) |
| **SearchCriteria**    | Enables field as search criteria                         |
| **ShowSearch**        | Displays field in search result table                    |
| **SearchFromTo**      | Enables range‑based search                               |
| **SearchPreLike**     | Enables wildcard `%XXX` search                           |
| **SearchLike**        | Enables wildcard `XXX%` search                           |
| **SearchIgnoreCase**  | Case‑insensitive search                                  |
| **JoinSearchTable**   | Used when JOIN SQL is required                           |
| **SearchFieldGroup**  | Horizontal position in search criteria                   |
| **SearchCriteriaSeq** | Vertical position in search criteria                     |
| **ShowSearchSeq**     | Order in search results                                  |

***

#### 7️. UI & Behavior Flags

| Property        | Description                               |
| --------------- | ----------------------------------------- |
| **Alignment**   | Text alignment: Left / Center / Right     |
| **OnlyGuiFlag** | UI‑only field (not persisted to database) |
| **ViewFlag**    | Displays field in read‑only mode          |
| **KeepHistory** | Persists history of value changes         |
| **FilterFlag**  | Filters records in 1‑Many Modules         |
| **Authen**      | Applies IAM‑based authorization           |
| **MergeFlag**   | Field spans across multiple columns       |

***

#### 8️. Validation Rules (Validate Code)

| Code                 | Description                             |
| -------------------- | --------------------------------------- |
| `CHECK_NULL`         | Prevents saving if no value is selected |
| `CHECK_INTEGER`      | Ensures integer value type              |
| `CHECK_DECIMAL`      | Ensures decimal value                   |
| `CHECK_EMAIL_FORMAT` | Validates email format                  |

***

### MultiSelect vs Checkbox

| Aspect               | MultiSelect   | Checkbox     |
| -------------------- | ------------- | ------------ |
| Data Source          | Dynamic (DB)  | Static       |
| Storage              | Mapping table | Single field |
| Best for Large Sets  | ✅ Yes         | ❌ No         |
| Many‑to‑Many Support | ✅ Native      | ❌ Limited    |
| UI Scalability       | ✅ High        | ⚠️ Limited   |

***

### Usage Guidelines

* Use **MultiSelect** for real relational multi‑value data
* Prefer MultiSelect over Checkbox for large datasets
* Always configure **Destination Table** and keys correctly
* Avoid using MultiSelect without persistence logic
* Test insert, update, and delete behavior thoroughly
* Index mapping tables for performance

***

### Summary

The **MultiSelect** field is a powerful component for managing **multiple related values** with proper relational persistence.

Key points:

* Supports true multi‑value selection
* Uses dedicated destination tables
* Ideal for many‑to‑many relationships
* Dynamic, scalable, and database‑driven
* Integrates with search, validation, and IAM

When used correctly, MultiSelect enables **robust data modeling and clean UI design** for complex enterprise Smart Forms in ONEWEB.


---

# 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.onewebstack.com/designer-reference/app-designer/entity/create-new-entity/fields/multiselect.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.
