# dataFromString

## Description

This will replace all the existing records in the local table with the new records. The values inserted must be in a JSON format.

## Input / Parameter

| Name    | Description                                                     | Input Type  | Default | Options | Required |
| ------- | --------------------------------------------------------------- | ----------- | ------- | ------- | -------- |
| dataset | The name of the local table to be edited.                       | String/Text | -       | -       | Yes      |
| string  | The values to be inserted in the local table.                   | Array/List  | -       | -       | Yes      |
| append  | Inserts the specified content at the end of a selected element. | String/Text | -       | -       | No       |
| extra   | Extra parameters stored and passed to callback.                 | Any         | -       | -       | No       |

## Output

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

## Callback?

### callback

The function to be executed if the local table is updated with the new records successfully.

### errorCallback

The function to be executed if the local table is not updated with the new records successfully.

## Video

Coming Soon.

## Example

The user wants to replace all the existing records in the local table with the new ones.<br>

### Step

1. Call the function "dataFromString", set the dataset and set the function "jsonDecode" to string.\
   dataset: l\_customer\
   string: jsonDecode<br>

   ![](/files/woxX2T15d6T9nt5XmBJw)
2. Call the function "toArray" and set the function "toObject" to string and define the id and code.\
   string: toObject\
   id: 1\
   code: C00013\
   id: 2\
   code: C00014\
   id: 3\
   code: C00015\
   id: 4\
   code: C00016<br>

   ![](/files/9jNvpOUFnOUA1zYYoXE0)

   ![](/files/eDXXMfgt0Mf2QsM5lEyT)

   ![](/files/wed6VcgGVWqwEObOdTm8)

   ![](/files/jDKo03yPYLXaHdVZZbTZ)

   ![](/files/TrEFTFckSx3e7gAm1WiH)

### Result

![](/files/FQKPra8ZVDKGXNZp9B9E)<br>

![](/files/FUjHY6uzUCLTN0WRWjI6)

## 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/datafromstring.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.
