# updateByMulti

## Description

Updates records from multiple fields in a dataset.

## Input / Parameter

| Name     | Description                                             | Input Type  | Default | Options | Required |
| -------- | ------------------------------------------------------- | ----------- | ------- | ------- | -------- |
| dataset  | The name of the local table to update the records from. | String/Text | -       | -       | Yes      |
| first    |                                                         | String/Text | -       | -       | No       |
| filter   | The filters for the field and value to update.          | Array/List  | -       | -       | Yes      |
| orFilter | Additional filters for the field and value to update.   | Array/List  | -       | -       | No       |
| data     | The data to update the records with.                    | Object      | -       | -       | Yes      |
| extra    | Extra parameters stored and passed to callback.         | Any         | -       | -       | No       |

## Output

| Description                                               | Output Type |
| --------------------------------------------------------- | ----------- |
| Returns the updated list of records from the local table. | Array/List  |

## Callback

### callback

The function to be executed if the specified records are updated successfully.

### errorCallback

The function to be executed if the specified records are not updated successfully.

## Video

Coming Soon.

## Example

The user wants to update the name from ABC to A1A2A3A4 and tel from 1234567 to 1111111111 in dataset "l\_customer".

### Step

1. Call the function "updateByMulti" and define the dataset.\
   dataset: l\_customer<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-d597cb0a2451a94e8a49c23cf0ec1ce7e1636a86%2FupdateByMulti-step-1.png?alt=media)
2. Set toArray and toObject function to filter and define the value of object.\
   filter: toArray --> toObject\
   id: 25\
   code: C12345<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-247c41e804555ecad7ac65ae2d2f92053abfb838%2FupdateByMulti-step-2.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e144513adb6afffcb9154865613b88a9a79885d7%2FupdateByMulti-step-3.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-c3a81de19f542c13514727a7553a61a1283f0f02%2FupdateByMulti-step-4.png?alt=media)
3. Set toObject function to data and define the value of object.\
   name: A1A2A3A4\
   tel: 1111111111<br>

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-6b0086630ef87dbc9a29fd48d8cbf9ac7a80c5b1%2FupdateByMulti-step-5.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-27e2c1c9f966a901e607572b5b7846b73116a036%2FupdateByMulti-result-1.png?alt=media) ( Before update, the name is ABC and tel is 1234567 )

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-f5d3baa7bb4761eb5a500b8cda5fbacac93f9430%2FupdateByMulti-result-2.png?alt=media) ( After update, the name changed to A1A2A3A4 and tel is 1111111111 )

## Links
