> 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/insertdata.md).

# insertData

## Description

Insert or add value in a staging database.

## Input / Parameters

| No | Name    | Description                                                              | Data Type | Required |
| -- | ------- | ------------------------------------------------------------------------ | --------- | -------- |
| 1  | dataset | Name of the dataset in stagging table where the record will be inserted. | String    | Yes      |
| 2  | param   | Object name                                                              | Object    | Yes      |

## Output

## Callback

## Video

## Example

The user wants to insert the data into staging table.

### Step

1. Create a table with a table name and field in staging table.\
   table name: customer\
   Fields name: tel, name and add

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

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-9f03557b3889a0cedf1578d57cc3be42d7a2074e%2FinsertData-step-2.png?alt=media)
2. Create a dataset is in Services.\
   dataset: customer\_1<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-6dec337af04de82458b0b9cc60e15f12b82e2f46%2FinsertData-step-3.png?alt=media)
3. Call the function "insertData", define the dataset and set function "toObject"to param.\
   dataset: customer\_1\
   param: toObject<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-1fc6c80fbe19727ee600b0350e48c0a493a1d2d1%2FinsertData-step-4.png?alt=media)
4. Define the tel, name and add.\
   tel: 34345678\
   name: 111\
   add: abc<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-579fddce4499b7f31e4df53a57f9c2bda2828253%2FinsertData-step-5.png?alt=media)
5. Call the function "loadData"and define the dataset.\
   dataset: customer\_1<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-737939cd3caf23c5125c8c722a24c6ebde3432d5%2FinsertData-step-6.png?alt=media)
6. Add a console after callback for display the response from console.

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

### Result

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

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

## Notes

* N/A
