04-01-2020, 05:49 PM
(This post was last modified: 04-01-2020, 05:50 PM by mark_talluto.)
This code will demonstrate how to query cloud data for a specific key and value. It will then update that value for all the matching records and update the cloud.
Code:
on mouseUp
local tInputA, tOutputA, tUpdatedLastName, tTableID
put "Franklin" into tUpdatedLastName
put cdb_tableID("Agents") into tTableID
--QUERY FOR MATCHING DATA
put cdb_query("lastName","=","Talluto","Agents","cloud","recordList") into tOutputA
--REPEAT THROUGH EACH RECORD AND UPDATE THE 'lastName' VALUE FOR EACH RECORD FROM THE QUERY
repeat for each line xRecordID in tOutputA
put tUpdatedLastName into tInputA[tTableID][xRecordID]["lastName"]
end repeat
--UPDATE DATA IN THE CLOUD
cdb_batchUpdate tInputA, "cloud"
end mouseUp