Actions

execute-entity

6min

Execute-entity can save, update, or delete data in a single row from a database, depending on the chosen method. Each datasource type (Dynamic / SQL / REST) will have a different syntax for updating, saving, and deleting data.

For the Dynamic datasource, values will be saved under the data option. For SQL/REST datasource, values will be saved under the functionParameters option.

This action can't be used if you are using Static Data.

Configuration options

An execute-entity action can be used in multiple areas:

  1. Under the action button
  2. In action list
  3. In onPress/onChange events (if the component you are setting up has these options)
  4. In onRefresh/onFocus

The execute-entity has a go-back option, which is set to on by default. That means when you run execute-entity, it will automatically return you to the previous .

Offline remote data handling

Dealing with offline remote data is fundamental to ensuring data synchronization and consistency between the mobile app and the remote data source, allowing users to continue using the app and performing actions without interruption. Offline remote data handling explains how to configure solutions to deal with data when the device is offline using the queueOperations property available in execute-entities and provides examples and code samples.

Examples and code snippets 

Execute entity
Execute enitity


In this example, execute entity is used in action with the create method. This example results in creating a new record with the First name, Last name, Email, and Phone number information. Execute entity is called by the press of the Save details button on the bottom.

Example: See the full example of execute-entity in GitHub.

execute-entity-action

Execute entity in action-list
Execute entity in action-list


By pressing the Save details button the execute-entity action will be followed by the go-to action.

Examples: See the full example of execute-entity in GitHub.

execute-entity-action-list

Execute-entity in onPress
Execute-entity in onPress


Here is the example of execute-entity in onPress/onChange event in list-item.

Examples: See the full example using onChange in GitHub. See the full example using onPress you in GitHub.

onPress
onChange

Execute entity
Execute entity


Here is the example of execute-entity in onRefresh/onFocus. See the full example using onRefresh in GitHub. See the full example using onFocus in GitHub.

execute-entity-onRefresh
execute-entity-onFocus


Here is an example of deleting different data using execute-entity. There are always 2 options for how you can delete a record:

  1. Using SQL Select
  2. Using JSONata function

In the first two examples, you can see the same situation where you are deleting all the records where the name equals Jane.

The third example shows how to delete the first 3 records from your datasource.

delete-by-first-name
delete-by-fist-name-jsonata-function
delete-first-3-records




Updated 04 Nov 2024
Doc contributor
Did this page help you?