09-01-2020, 12:59 AM
Hi Stam,
We need to understand better the structure of your data.
Are you able to take a screenshot of the variable watcher showing a view of your data?
How many times is the repeat looping?
Your query looks like it is trying to get all the record IDs of a given key from a single table. The fastest way to get all the recordIDs of a given table is to use: https://docs.livecloud.io/List/
All this said I think you have developed a type of sync. I think you are trying to determine which record IDs are missing in the cloud. You then cdb_batchCreate all the missing data to the cloud. That is pretty clever. I think we can save you some time.
The fastest way to sync is use: https://docs.livecloud.io/Sync/
This function will do all the heavy lifting for you in a single line of code. It will give you the freedom to consider data collisions and handle deleting records that are not in the source.
It would look something like:
get cdb_sync("*", "tableNameHere", "local", false, false)
--The asterisk is used to indicate that you want to consider all records in both the source and target of the sync operation.
--First false prevents unique data in the cloud from being deleted
--Second false says not to compare the versions of the records and replace data in the cloud with what is in the local data.
Please feel free to experiment with both of those booleans to get the desired result.
Let me know how this goes for you.
We need to understand better the structure of your data.
Are you able to take a screenshot of the variable watcher showing a view of your data?
How many times is the repeat looping?
Your query looks like it is trying to get all the record IDs of a given key from a single table. The fastest way to get all the recordIDs of a given table is to use: https://docs.livecloud.io/List/
All this said I think you have developed a type of sync. I think you are trying to determine which record IDs are missing in the cloud. You then cdb_batchCreate all the missing data to the cloud. That is pretty clever. I think we can save you some time.
The fastest way to sync is use: https://docs.livecloud.io/Sync/
This function will do all the heavy lifting for you in a single line of code. It will give you the freedom to consider data collisions and handle deleting records that are not in the source.
It would look something like:
get cdb_sync("*", "tableNameHere", "local", false, false)
--The asterisk is used to indicate that you want to consider all records in both the source and target of the sync operation.
--First false prevents unique data in the cloud from being deleted
--Second false says not to compare the versions of the records and replace data in the cloud with what is in the local data.
Please feel free to experiment with both of those booleans to get the desired result.
Let me know how this goes for you.