Query and Bind Data
After configuring the database or API, fetch data through data sources and bind it to pages and components.
- List components configure data sources directly
- Pages and other components declare a page-level data source first
Workflow
Configure a data source
On pages or list components (List, Custom Selector, Data Selector):
- List components: Data tab in the right sidebar
- Pages: declare a data source on the page Data tab
For database sources:
| Setting | Purpose |
|---|---|
| Filter | WHERE conditions |
| Sort | Order; sort fields must match Distinct fields when both are used. Vector fields enable semantic sort |
| Distinct | Dedupe by field(s) |
| Limit | 1 = single record; >1 = array |
⚠️
When a value bound to a filter is null, the filter may not narrow the query as expected. Do not rely on an empty value to filter out records automatically.
If the query should return no records when the input is empty, use conditional data to replace null with a value that cannot exist. For example, replace an empty positive integer ID with -1.
Bind data
Bind query results to component content, component actions, or page actions.
| Source | Reference path |
|---|---|
| Page data source | Page data → data source |
| List data source | Component data → list → list item / index |
Example: blog CRUD
Uses database, parameters, and database operations.
Data model
posttable:title,content,author,published_status,show_at,like_count— one-to-many from account viaauthornotificationtable:sender_account,receiver_account,message— sender/receiver relations to account
.png)
Create — publish article
- Writing page with title input and rich text editor
- Insert action on Add button
- Map inputs to
postfields;author= logged-in accountid
.png)
Read — article list
- List on home → data source
post - Filter
published_status = true; sortshow_atdescending - Bind title, cover to list item fields
.png)
Read — detail page
- Detail page with path parameter
blog_id - List item Navigate action sets
blog_idfrom itemid - Page data source filter:
id = blog_id, limit1 - Bind fields to display content
.png)
Update — unpublish an article
- Add an Unpublish button on the detail page and configure an update action for
post - Filter by
id = page data source.id; verify the filter carefully because a broad filter can update multiple records - Set
published_statustofalse; on success, navigate back to the article list or refresh the data source
Notes
- Subscription: real-time push when data changes — chat, live dashboards
- Update/Delete: verify filters precisely — broad filters can affect entire tables
- Arrays: use formulas such as
GET_ITEM— see Formulas - Conditional values: Configure Conditional Data
Last updated on