LiveCloud Forums
cdb_batchSync - Printable Version

+- LiveCloud Forums (https://forums.livecloud.io)
+-- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=1)
+--- Forum: Code Samples (https://forums.livecloud.io/forumdisplay.php?fid=7)
+--- Thread: cdb_batchSync (/showthread.php?tid=189)



cdb_batchSync - mark_talluto - 10-11-2019

Here is some sample code on how to use cdb_batchSync

//THIS API WILL SYNC MULITPLE TABLES AT ONCE
//pInputA: This array contains primary keys of tableID. The secondary keys are
//(cdbRecordID,source,allowDeletes,detectCollisions)

—REPEAT THROUGH ALL TABLES AND BUILD AND INPUT ARRAY
—THIS EXAMPLE WILL DO FULL TABLE SYNCS
—YOU COULD SWITCH OUT THE ‘*’ FOR LINE DELIM RECORD IDS IF YOU WANT TO DO PARTIAL SYNCS
repeat for each line xTableID in cdb_tableID("*")
  put "*" into tInputA[xTableID]["cdbRecordID"]
  put “cloud" into tInputA[xTableID]["source"]
  put true into tInputA[xTableID]["allowDeletes"]
  put true into tInputA[xTableID]["detectCollisions"]
end repeat

put cdb_batchSync(tInputA) into tResults
if not cdb_result() then
  put "Error:" && cdb_result("response")
end if