• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tip needed on working with data locally
Hi. I'm full of questions and have appreciated several helpful answers so far.

To speed processing I'm trying to reduce the number of queries to the cloud my app needs to make. So I'd like to query, retain the data locally temporarily and make further queries to local. Then at end of session update any records that have changed to the cloud. I've wondered about three approaches I hope could work.

1) I make this query.

cdb_batchQuery(tInputA,"cloud","logicalAND","recordData") into tOutputA

Can tOutputA be queried and updated as if it were a table? If so, what's the syntax?

2) If what I've suggested above isn't possible, what is the syntax to populate the data in tOutputA to a local table?

Is put cdb_batchCreate(tInputA, "local") into tOutputB sufficient or are steps required before that command to create a new table?

3) I am aware of the cdb_loadTable command, but I would greatly prefer not to load the entire table, but instead a subset of the table's contents defined by a query. Is that doable?

I imagine there are good solutions available. What are they? Thanks in advance!
Hi sltfn,

You can use sync to download a table to your device and make it available locally. This will allow you to perform all the same APIs on the data without having to make cloud calls. Then at the end of the session you can sync the table back up to the cloud and any changes (new records, records deleted, records updated, etc) will be made to the cloud.

cdb_sync(pRecordIDL, pTable, pSource, pAllowDeletes, pDetectCollisions)

You mentioned you would prefer a subset of the table instead of the entire table. To do this, pRecordIDL will be a line delimited list of recordIDs corresponding to the subset of the table you are interested in. Once the table is local, you just need to pass "local" instead of "cloud" to the APIs and no more cloud calls.

Hope this helps. Let me know if you have any questions.

Forum Jump:

Users browsing this thread: 1 Guest(s)