how to append data

Answered

How to append data to the existing csv? Will it unload the previously loaded data and
reload the entire new csv file? I want to know if it support incremental/append in data?

1 answer

WebDataRocks Team WebDataRocks November 25, 2019

Hello,
 
Thank you for your question.
 
The current WebDataRocks version supports appending data only for the JSON data source.
 
It is implemented through updateData method with its `partial` parameter that has to be set as true.
 
Our team kindly recommend investigating the following instruction:

  1. First of all, we add id and delete types to the first object of JSON array:
    {
    "Category":
    { "type": "string" },   
    "Price": { "type": "number" },
    "RowId": { "type": "id" },
    "DeleteRow": { "type": "delete" }
    }
  2. Then, when defining the data, we specify an id field for every object the following way:
    {
    "Category": "Accessories",
    "Price": 242,
    "RowId": 1
    }
  3. To add or update only some of the records use partial: true:
    var dataForUpdate = [{
    "Category": "Cars",
    "Price": 51844,
    "RowId": 4
    }]
    webdatarocks.updateData({data: dataForUpdate}, {partial: true});
  4. To delete the records specify id and delete fields:
    var dataForUpdate = [{
    "RowId": 3,
    "DeleteRow": true
    }]
    webdatarocks.updateData({data: dataForUpdate}, {partial: true});

 
Please, check out an example we made for you.
 
Regards,
WebDataRocks Team