how to append data
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
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:
- 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" }
} - Then, when defining the data, we specify an id field for every object the following way:
{
"Category": "Accessories",
"Price": 242,
"RowId": 1
} - 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}); - 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