collect_app_records
Use this action to collect records from a database app into a record collection that later actions can use.
Read the live config shape of each action type from GET /v1/automation/meta/action before you build on it.
In the automation editor, this action is Search for records in the Record collections family. Its group is action, and it works with every trigger.
Send it in the actions array of Create an automation or Update an automation. An update replaces the whole array, so include the other actions.
Example
This action collects up to 100 listings whose Address field isn't empty:
{
"type": "collect_app_records",
"config": {
"app_id": 4821,
"match_condition": {
"operator": "and",
"rows": [
{
"subject": {
"kind": "variable",
"source": "field",
"field_id": 55012,
"field_type": "single_text",
"previous": false,
"collection": false,
"triggering": false
},
"operator": "is_not_empty"
}
]
},
"limit": 100,
"limit_enabled": true
}
}
Config
| Property | Type | Description | Example value |
|---|---|---|---|
app_id | integer | ID of the database app to collect records from. Without it, Tape skips the action when the automation runs. | 4821 |
match_condition | filter group | null | Filters the records to collect. Left out, Tape collects every record of the database app. A filter that matches everything reads back as null. | null |
limit | integer | Maximum number of records to collect. Takes effect only when limit_enabled is true. Default 1. | 100 |
limit_enabled | boolean | Whether Tape applies limit. Default false. | true |
To find app_id and the field IDs for match_condition, see App and field IDs.
Use the collection in later actions
This action creates a record_collection for the database app in app_id. A later action references it with this object:
{ "kind": "variable", "source": "action", "action_type": "record_collection", "app_id": 4821 }
- Tape resolves the reference to the nearest earlier action that creates a collection for the same
app_id. - Use it in
filter_record_collection,sort_record_collection,clear_record_collection, thecollected_records_*actions and theiterableof afor_loop. - See Record collections for the pattern.
General behavior
- Every key is optional when you save. Tape fills in the defaults.
- Every collect stops at 1000 records when the automation runs, with or without
limit_enabled. - Tape stores a
limitabove 1000 and reads it back unchanged. Neither the write norvalidatewarns. See Limits and throttling. - Without
app_id, the action saves and passes validation. When the automation runs, Tape skips it. - An
app_idof a deleted app fails validation withaction_app_missing. Anapp_idthat never existed makesvalidateand activate return404. See Errors & broken reasons.
Requirements
- To add or change this action through the API, your token needs the
automations:editcapability. See Capabilities. - You must administer the workspace that the automation's database app belongs to.