# insert

## Description

Inserts values specified by the user into a local table.

## Input / Parameter

| Name    | Description                                       | Input Type  | Default | Options | Required |
| ------- | ------------------------------------------------- | ----------- | ------- | ------- | -------- |
| dataset | The name of the local table to be insert data to. | String/Text | -       | -       | Yes      |
| dt      | The values to be inserted in the local table.     | Object      | -       | -       | Yes      |
| extra   | Extra parameters stored and passed to callback.   | Any         | -       | -       | No       |

## Output

| Description                                | Output Type |
| ------------------------------------------ | ----------- |
| Returns the updated local table as a list. | Array/List  |

## Callback?

### callback

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

### errCallback

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 insert the id=23 into the dataset "l\_customer".

### Step

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

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

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

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-6bcc95aefd6cb26cfbfd8656b3785310e6e031fc%2Finsert-result-1.png?alt=media) ( Before insert, the id is until id=22 )

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-990597a0ffc0e2dff6dac04a6215009dd26f7483%2Finsert-result-2.png?alt=media) ( After insert, the id=23 successful add into the dataset "l\_customer" )

## Links
