> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/dataset/updateby.md).

# updateBy

## Description

Updates the record from a specified field in a dataset.

## Input / Parameter

| Name     | Description                                            | Input Type  | Default | Options                          | Required |
| -------- | ------------------------------------------------------ | ----------- | ------- | -------------------------------- | -------- |
| dataset  | The name of the local table to update the record from. | String/Text | -       | -                                | Yes      |
| by       | The name of the field to update the record from.       | String/Text | -       | -                                | Yes      |
| operator | The operator to use to determine the record to update. | String/Text | =       | =, >, <, >=, <=, !=, like, ilike | No       |
| value    | The record to be updated from the local table.         | String/Text | -       | -                                | Yes      |
| data     | The data to update the record with.                    | Object      | -       | -                                | Yes      |
| first?   | ?                                                      | String/Text | -       | -                                | No       |
| 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.

### errCallback

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

## Video

Coming Soon.

## Example

The user wants to update the code from E1234567 to E1234 in dataset "l\_item".

### Step

1. Call the function "updateBy".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-4a16bd95592b0475e94d1ee1ba94c19530aaa984%2FupdateBy-step-1.png?alt=media)
2. Specify the parameters:

   |          |          |
   | -------- | -------- |
   | dataset  | l\_item  |
   | by       | code     |
   | operator | =        |
   | value    | E1234567 |

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-11c6c4ccab22d93da46d057b8829da6de3b7fd37%2FupdateBy-step-2.png?alt=media)
3. Set toObject function to data and define the value of object.

|      |          |
| ---- | -------- |
| data | toObject |
| code | E1234    |

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

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

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-fd9262fedeb6a488deae3b4060399946d33d03fb%2FupdateBy-result-1.png?alt=media) ( Before update, the code is E1234567 )

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-46a1e73008f00a86dc870b4d4c24b16d29743523%2FupdateBy-result-2.png?alt=media) ( After update, the code changed to E1234 )

## Links
