# 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".

   ![](/files/TO5Ub7WLWbMCI4CCL7HV)
2. Specify the parameters:

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

   ![](/files/I2tQQi3FvmF62b3dV1xb)
3. Set toObject function to data and define the value of object.

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

![](/files/jc8IxV8ia0tNV6GM6NBU)

![](/files/LTht3HwLiCc3hTV2btj2)

### Result

![](/files/cpkyIILnyeJaZGMyCNnJ) ( Before update, the code is E1234567 )

![](/files/LdEiDTycOvY0Wgqivpbt) ( After update, the code changed to E1234 )

## Links


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/dataset/updateby.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
