update

Description

Updates the data from a dataset.

Input / Parameter

FilterFormat (Object)

The format used for filtering in the parameter filter.

data (List)

Will contain a list of one (1) or more objects with the following structure (dataset, operator, value) and contain zero (0) or more objects with the same structure (FilterFormat only). This can be another FilterFormat to create grouped queries.

Output

Object

Callback

callback

The action performed if this function runs successfully.

errorCallback

The action performed if this function does not run successfully.

Example

In this example, we will update the local table data from the local storage.

Note: This example will only work after the user has created the data using `Dataset.insert` function).

Steps

  1. Create a Local Table in the services panel in the service page if there is no table created yet. For the fields, add nameand title as object key with Text type.

  2. Drag a button component to a page in the mobile designer.

  3. Select the event press and drag the Dataset.update function to the event flow and fill in the parameter. For the filter and data parameters, change it's type to a function / subflow.

  4. For the filter parameter, change it's type to a function / subflow and drag Conversion.toObject to the subflow. Then add data as an object key and change it's type to a function / subflow.

  5. Drag the function Conversion.toObject to the new subflow. Then add field, operator and value as object keys with name, like, n% as their values respectively.

  6. For the data parameter, it's type to a function / subflow and drag Conversion.toObject to the subflow. Then add title as an object key, with new value as it's value.

Result

  1. The data should be updated with the changes passed. The result can be printed in the console using the Dataset.read and Log.write functions.

  2. Refer to the example in Dataset.read for more information on viewing the data.

Last updated