The Query object
Query information and data.
Each Query object represents a query within an app, such as an SQL query or transformer. Each instance has a unique name with which to reference (e.g., getUsers.trigger()
).
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
allowedGroupIds
A list of allowed group IDs.
Type | array | ||||
Array values | string | ||||
Mutability |
| ||||
Default |
|
Examples
allowedGroups
A list of allowed groups.
Type | array | ||||
Array values | string | ||||
Mutability |
| ||||
Default |
|
Examples
cacheKeyTtl
The duration, in seconds, to cache query results.
Type | number | ||||
Format | Integer | ||||
Mutability |
|
Examples
changeset
Edited values for each row.
Type | array |
Format | Custom data |
Array values | object |
Mutability | Read-only |
changesetIsObject
Whether the changeset is an object.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Default |
|
Examples
changesetObject
A list of rows, by key or data index, with edited values. Keys correspond to either the primary key when the table is configured with a Primary key column or the data index of the changed row.
Type | object |
Format | Custom data |
Mutability | Read-only |
Examples
confirmationMessage
The message to display in the confirmation modal before running the query. Available if requireConfirmation
is true
and Run behavior is set to Manual.
Type | string | ||||
Format | Markdown | ||||
Mutability |
|
Examples
enableCaching
Whether to cache query results.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
|
Examples
enableErrorTransformer
Whether to enable the error transformer.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Examples
enableTransformer
Whether the query is transforming results.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
error
The error message if the action was unsuccessful.
Type | string |
Format | Plain Text |
Mutability | Read-only |
Examples
events
A list of configured event handlers that trigger actions or queries.
Type | array | ||||
Array values | object | ||||
Mutability |
|
Array Object Properties
finished
The timestamp for the most recent query run.
Type | number |
Format | Timestamp |
Mutability | Read-only |
Examples
importedQueryInputs
The inputs for imported queries.
Type | object |
Format | object |
Mutability | Read-only |
Default |
|
Examples
Examples
isImported
Whether the query was imported from the Query Library.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Examples
lastReceivedFromResourceAt
The timestamp for when data was last fetched. If enableCaching
is true
, the lastReceivedFromResourceAt
and cacheKeyTtl
properties determine whether to return results from the cache the next time the query runs.
Type | number |
Format | Timestamp |
Mutability | Read-only |
Examples
Array Object Properties
notificationDuration
The duration that a notification should remain visible, in seconds.
Type | number |
Format | Float |
Mutability | Read-only |
Examples
overrideOrgCacheForUserCache
Whether to override the organization cache for the user cache.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Examples
privateParams
A list of parameters to exclude from audit logs.
Type | object | ||||
Mutability |
|
query
The raw query string. For JavaScript and SQL queries, this is the entire query body. For REST API queries, this is the endpoint string.
Type | string |
Format | Plain Text |
Mutability | Read-only |
Examples
queryDisabled
Whether to disable the query.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
queryDisabledMessage
The message to display if queryDisabled
is true
.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
Examples
queryFailureConditions
A set of conditions which determine if the query has failed.
Type | object | ||||
Mutability |
|
Object Properties
queryRefreshTime
The interval, in milliseconds, in which the query refreshes automatically.
Type | number |
Mutability | Read-only |
queryRunOnSelectorUpdate
Whether the query runs when watched parameters change.
Type | string | ||||
Mutability |
|
queryRunTime
The duration, in milliseconds, of the most recent query run.
Type | number |
Mutability | Read-only |
queryTimeout
The duration, in milliseconds, to wait before the query times out. After 120 seconds (120000
ms), all queries time out, even if queryTimeout
is higher.
Type | number |
Mutability | Read-only |
queryTriggerDelay
The duration, in milliseconds, to wait after being triggered before running.
Type | number |
Format | Integer |
Mutability | Read-only |
Default |
|
Examples
requestSentTimestamp
The timestamp the query request was sent.
Type | number |
Format | Timestamp |
Mutability | Read-only |
Examples
requireConfirmation
Whether to require confirmation.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
|
Examples
runWhenModelUpdates
Whether to automatically run the query when its parameters change.
Type | boolean |
Mutability | Read-only |
runWhenPageLoads
Whether to automatically run the query when the app loads.
Type | boolean | ||||
Mutability |
|
runWhenPageLoadsDelay
The duration, in milliseconds, to delay running the query on page load.
Type | number | ||||
Mutability |
|
servedFromCache
Whether the most recent query results were returned from the cache.
Type | boolean |
Mutability | Read-only |
showFailureToaster
Whether to show a notification on query failure.
Type | boolean | ||||
Mutability |
|
showLatestVersionUpdatedWarning
Whether to show a warning if the latest version has been updated.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Examples
showSuccessToaster
Whether to show a notification on query success.
Type | boolean | ||||
Mutability |
|
showUpdateSetValueDynamicallyToggle
Whether to show the update set value dynamically toggle.
Type | boolean |
Format | True/False |
Mutability | Read-only |
Examples
streamResponse
Whether to stream the response.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
|
Examples
successMessage
The notification message to display on query success.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
Examples
timestamp
The timestamp at which the query started to run.
Type | number |
Format | Timestamp |
Mutability | Read-only |
Examples
updateSetValueDynamically
Whether to sync references from the query with the rest of the app.
Type | boolean |
Mutability | Read-only |
watchedParams
A list of watched parameters.
Type | array | ||||
Array values | string | ||||
Mutability |
|
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
query.invalidateCache()
Clear cached query data. The query retrieves results from the resource when next run.
query.invalidateCache()
Events
Events triggered by user interactions. Use event handlers to trigger queries or other actions in response to events.