Sign Up
Loading...

Related Records

Include related information in the same result instead of adding a separate lookup for each record in a list.

Example: orders with customers

Suppose your Orders table stores a customerId, and your Customers table contains the corresponding customer record.

  1. Add Get Multiple Data and select Orders.

  2. Set the filters and record limit you need.

  3. Open the command's Output tab.

  4. Under Related records, add a relationship.

  5. Select Customers as the related table.

  6. Match customerId in Orders to _id in Customers.

  7. Set Include as to customer.

  8. Choose one related record.

  9. Save and test.

Each returned order now includes its matching customer under customer.

Here is the first order from a sample result. Its related customer, Ada, appears inside customer. This example uses customerId as the matching field in Orders.

One record or a list

Choose one when you expect a single match, such as an order's customer. Choose list when there may be several matches, such as all items belonging to an order.

This settings example uses the same matching fields and shows List of related records. Select the one-record option for the customer example above.

Use an output name that does not overwrite an existing field. Ensure matching fields contain compatible values. Relationships look up matching records; they do not automatically create a relationship or repair inconsistent IDs.

Keep results manageable

Set an appropriate record limit and choose only the fields your app needs under Fields to return. Large lists with many related records can exceed the allowed result size.

Index frequently used matching fields to keep lookups efficient. See Database Indexes.

Related Topics

Authentication Table

An authentication table is a crucial component in Twidget that is used to store all necessary authentication information, essential for authenticating requests. Overview. - Purpose: To store authentication details such as email, password, token signature, and reset key. - Recommendation: It's recomm...

Database Indexes

Indexes help Twidget find records quickly. A unique index also prevents duplicate values from being saved. Choose the right index. Use a lookup index for a field you regularly filter or sort, such as an order date. Use a unique index when a value must not appear twice, such as a membership number. A...

Table Field Types

Each table column in Twidget has a data type. The available data types are: - Text - Number - Boolean - Date - Object Field Type Adherence. Data added to the table should adhere to the column's field type. When you manually enter data via the web application, the value editor will use the input type...

Adding Database Table Rows

In Twidget, you can easily add new entries (rows) to your database tables. This feature allows you to expand your data dynamically without the need for complex coding. This document provides a step-by-step guide on how to add rows to your database tables. Adding a New Entry to a Table. To add a new ...

Generate CRUD Endpoints

With Twidget, you can efficiently generate CRUD (Create, Read, Update, Delete) endpoints for your database tables upon their creation. This functionality is designed to streamline the development process and ensure that essential API operations are readily available. Enabling CRUD Endpoints. 1. Crea...