09-09-2019, 06:09 PM
(This post was last modified: 09-09-2019, 10:58 PM by mark_talluto.)
This is a great question. The data is returned to you as a LiveCode array. I took a picture of the result I got from running some test code I put together. You can see that the data returned contains three matching records from my query.
I added a few little things that may be useful in what you can do once you have the data. In this case, I am modifying one of the keys on each record and then batch updating the changes to the cloud.
Here is the code that generated the results:
I added a few little things that may be useful in what you can do once you have the data. In this case, I am modifying one of the keys on each record and then batch updating the changes to the cloud.
Here is the code that generated the results:
Code:
local tOutputA, tKeys, tTableID, tUpdatedDataA
put cdb_query("firstName","starts with","M","Agents","cloud","recordData") into tOutputA
--GET THE RECORD IDS
put the keys of tOutputA into tKeys
--GET TABLE ID
put cdb_tableID("Agents") into tTableID
--CRAWL THROUGH EACH RECORD TO GET ACCESS TO THE DATA RETURNED
--WRITE THE FIST NAME FOR ALL RETURNED RECORDS INTO A LIST FIELD
repeat for each key xRecordID in tOutputA
--put tOutputA[xRecordID]["firstName"] & lf after field "list"
--MODIFY THE INCOME KEY BY ADDING 1000 TO THE EXISTING VALUE
add 1000 to tOutputA[xRecordID]["income"]
--PREPARE THE UPDATED DATA TO BE UPLOADED
repeat for each key xKey in tOutputA[xRecordID]
put tOutputA[xRecordID][xKey] into tUpdatedDataA[tTableID][xRecordID][xKey]
end repeat
end repeat
--UPLOAD THE UPDATED DATA TO THE CLOUD
cdb_batchUpdate tUpdatedDataA, "cloud"