# Suggestion

The **Suggestion** field is an input component that provides **real‑time suggestions in a dropdown list** based on the text typed by the user.\
It supports **keyword search** and dynamically retrieves matching data, helping users quickly find and select the correct value.

Suggestion fields are ideal when the dataset is large and users should not scroll through long lists manually.

***

### Purpose of Suggestion Field

The Suggestion field is designed to:

* Suggest relevant values as the user types
* Support fast lookup using keywords
* Reduce user input errors
* Improve usability when dealing with large datasets

#### Typical Use Cases

* Customer search by name
* Product lookup
* Employee or user selection
* Searching reference or master data

***

### Adding and Configuring a Suggestion Field

To add a Suggestion field:

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

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FKkymA3h5GUUozKDz2e7B%2Fimage.png?alt=media&#x26;token=f1349437-c57a-4a29-84ec-4902f2fdd173" alt=""><figcaption></figcaption></figure>

***

### Suggestion Configuration Properties

#### 1️. Core Identification

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

***

#### 2️. Field Behavior & Appearance

| Property          | Description                                                    |
| ----------------- | -------------------------------------------------------------- |
| **Source Tag**    | Allows JavaScript at field level (e.g. `readonly`, `onchange`) |
| **Max Length**    | Maximum number of characters allowed for input                 |
| **Size**          | Display width of the input field                               |
| **Default Value** | Initial value when the form loads                              |

***

#### 3️. Data Source Definition

These settings determine where suggestion data is retrieved from.

| Property        | Mandatory | Description                                |
| --------------- | --------- | ------------------------------------------ |
| **Table Name**  | Yes       | Database table used as suggestion source   |
| **Column Show** | Yes       | Column displayed to the user               |
| **Condition**   | No        | SQL condition to filter suggestion results |

***

#### 4️. Dependency Configuration

Suggestion fields can support dependency behavior similar to Dynamic List.

| Property            | Description                                       |
| ------------------- | ------------------------------------------------- |
| **Global ID**       | Global identifier for dependency resolution       |
| **Dependency Data** | Enables dependent behavior                        |
| **Depend Column**   | Column whose values depend on another field       |
| **Sequence**        | Evaluation order when multiple dependencies exist |

***

#### 5️. Database Mapping

| Property      | Description                                  |
| ------------- | -------------------------------------------- |
| **Field\_ID** | Database column mapped to the selected value |

***

#### 6️. Display & Condition Tab Settings

| Property          | Description                                           |
| ----------------- | ----------------------------------------------------- |
| **ShowFieldName** | Label displayed on screen (auto‑generated supported)  |
| **Condition Tab** | Enables conditional tab logic triggered by this field |

***

#### 7️. Search Configuration

| Property              | Description                               |
| --------------------- | ----------------------------------------- |
| **SearchCriteria**    | Enables field as search criteria          |
| **ShowSearch**        | Displays field in search results 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 positioning in search criteria |
| **SearchCriteriaSeq** | Vertical positioning in search criteria   |
| **ShowSearchSeq**     | Order in search result table              |

***

#### 8️. 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 change history                   |
| **FilterFlag**  | Filters records in 1‑Many Modules         |
| **Authen**      | Applies IAM‑based authorization           |
| **MergeFlag**   | Field spans across multiple columns       |

***

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

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

***

### Suggestion vs Dynamic List vs List Box

| Feature            | Suggestion          | Dynamic List        | List Box        |
| ------------------ | ------------------- | ------------------- | --------------- |
| Data Source        | Database            | Database            | Static          |
| User Interaction   | Type‑to‑search      | Dropdown select     | Dropdown select |
| Handles Large Data | ✅ Yes               | ⚠️ Limited          | ❌ No            |
| Dependency Support | ✅ Yes               | ✅ Yes               | ❌ Limited       |
| Best Use Case      | Search‑heavy lookup | Cascading dropdowns | Fixed values    |

***

### Usage Guidelines

* Use **Suggestion** when datasets are large
* Prefer over Dynamic List for keyword‑based lookup
* Ensure proper indexing on source tables for performance
* Define meaningful `Column Show` values for usability
* Apply validation to prevent incorrect selections
* Avoid excessive dependency chains

***

### Summary

The **Suggestion** field provides an efficient and user‑friendly way to select data from large datasets using **keyword‑based suggestions**.

Key points:

* Real‑time suggestions as user types
* Database‑driven and searchable
* Supports dependencies and conditions
* Integrates with search, validation, and IAM
* Ideal for high‑volume reference data

When used appropriately, Suggestion fields significantly enhance **user experience, performance, and data accuracy** in ONEWEB Smart Forms.


---

# 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/oneweb-platform-th/designer-reference/app-designer/entity/create-new-entity/fields/suggestion.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.
