# One‑to‑Many (1–Many) Module

A **One‑to‑Many (1–Many) Module** is used to display and manage **multiple related records** in the database.\
It is typically used for **detail or child data**, where one parent Entity is associated with many child records.

The 1‑Many Module presents data primarily in **tabular (Grid)** or **Card** layout, making it suitable for handling **large numbers of items and columns** efficiently.

***

### Purpose of 1–Many Module

The 1–Many Module is designed to:

* Manage collections of related records
* Display repeating data in a structured way
* Support business scenarios involving line items or lists
* Allow users to add, edit, and view multiple records under a parent entity

Typical business examples include:

* Order → Order Items
* Invoice → Invoice Lines
* Customer → Address List

***

### Layout Characteristics

A 1‑Many Module supports two primary layout styles:

* **Grid Layout**
  * Table‑based presentation
  * Suitable for dense data and many columns
* **Card Layout**
  * Card‑based visual presentation
  * Suitable for mobile‑friendly or summary views

The layout type can be configured via the module settings.

***

### 1–Many Module Configuration

The 1–Many Module provides a configuration panel that can be accessed via the **Module Configuration** icon ![](https://docs.oneweb.tech/oneweb/~gitbook/image?url=https%3A%2F%2F2015371994-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FMpDjHWFRUtZ5nJcSfVXd%252Fuploads%252FTe7E7zVJ8RwXZxZJiQfx%252Fimage.png%3Falt%3Dmedia%26token%3D68702403-8a26-4da3-917f-79726452c61d\&width=300\&dpr=3\&quality=100\&sign=ef3984c3\&sv=2)\
This configuration panel allows users to define database mapping, layout behavior, and advanced data retrieval logic.

***

#### 1–Many Module Configuration Properties

| Property               | Mandatory   | Description                                           |
| ---------------------- | ----------- | ----------------------------------------------------- |
| Module ID              | Yes         | System‑generated unique identifier                    |
| Module Name            | Yes         | Name of the module                                    |
| Table Name             | Yes         | Database table associated with the module             |
| Template Code          | Yes         | UI template (inherits from Entity)                    |
| Theme Code             | Yes         | UI theme (inherits from Entity)                       |
| Show List Layout       | Yes         | Select **GRID** or **CARD** layout                    |
| Module Key             | Yes         | Primary key field of the module                       |
| Prefix                 | No          | Prefix for auto‑generated keys                        |
| Postfix                | No          | Suffix for auto‑generated keys                        |
| KeyLen                 | No          | Length of key value                                   |
| Sequence               | Conditional | Database sequence for key generation                  |
| SQL Show List          | No          | Custom SQL to retrieve list data (specific to 1–Many) |
| SQL Duplicate Function | No          | Used for duplicate handling logic                     |
| View Mode Flag         | No          | Set module to read‑only mode                          |
| Paging Flag            | No          | Enable pagination for large datasets                  |
| Ordering Flag          | No          | Enable column sorting in grid                         |
| Multiple Table Flag    | No          | Reserved for advanced use cases                       |

> **Note**\
> Properties such as `SQL Show List` are especially useful in 1–Many Modules where data retrieval logic requires joins or custom conditions.

***

### Module Actions

#### Delete Module

<div align="left"><figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2Fn7UdNSOa8CWf9CKyX9L2%2Fimage.png?alt=media&#x26;token=ebeeef06-bf2f-4b77-969c-6e97890c5d07" alt=""><figcaption></figcaption></figure></div>

* This icon removes the selected 1‑Many Module from the Smart Form layout
* Deleting a module does **not** delete the underlying database table

***

### Usage Guidelines

* Use **1–Many Modules** only for repeating or child records
* Always map one 1–Many Module to **one database table**
* Enable paging and sorting when handling large datasets
* Use Grid layout for data‑dense use cases
* Use Card layout for flat or mobile‑oriented designs
* Use custom SQL only when standard configuration is insufficient

***

### Summary

The **One‑to‑Many (1–Many) Module** is essential for modeling **repeating and detail data** in Smart Forms.

Key points:

* Manages multiple records per parent entity
* Displays data in Grid or Card layouts
* Optimized for large datasets
* Strong integration with database tables
* Supports advanced SQL‑based data retrieval

Proper use of 1–Many Modules ensures Smart Forms are **scalable, structured, and aligned with real‑world master–detail business models**.


---

# 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/module/one-to-many-1-many-module.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.
