importTable
Imports one or multiple tables to the app that have beed previously save as a JSON file using the exportTable action.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" (required) | Object | undefined | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" (required) | String | Type name of the action. | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"type" | ImportTableType | Determines how the table date should be inserted. | "replace" |
Examples
Example 1: Import a single or multiple tables
Goal: Import a file that contains a set of tables previously exported from the app and display a success or error message to the user depending on whether the import was successful or not.
main file (i.e. inside a client template)
{
"type": "importTable",
"params": {
"type": "replace",
"onErrorType": "breakingEvent",
"onError": "importTableError",
"onSuccessType": "return"
}
}
{
"type": "showMessage",
"params": {
"text": "$lang(importTableSuccess)$",
"asToast": true
}
}
event/importTableError.json
{
"name": "importTableError",
"content": {
"type": "importTableError",
"actions": [
{
"type": "showMessage",
"params": {
"text": "$lang(importTableError)$",
"asToast": true
}
}
]
}
}
Make sure the type
param of the importTable
action is set correctly when importing the tables to prevent accidential overwrites of existing data.
Result:
An importTable action has been created.