Skip to main content
Version: 4.58

importTable

Imports one or multiple tables to the app that have beed previously save as a JSON file using the exportTable action.

Field Configurations​

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params" (required)Objectundefinednull
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type" (required)StringType name of the action.null

Parameters​

KeyTypeDescriptionDefault Value
"async"BooleanSpecifies whether the action should perform asynchronously.null
"type"ImportTableTypeDetermines 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.