Type Function Return value none Revision 2017.3060 Keywords iCloud, sync, storage, CloudKit, recordFetchMultiple See also iCloud.recordFetch() iCloud.recordQuery() iCloudRecordEvent iCloud.*
Retrieves multiple records. onRecord
listener function and final results are passed to the onComplete
listener function, both as an iCloudRecordEvent.
iCloud.recordFetchMultiple( params )
Table. Table containing
Valid keys for the params
table include:
recordNameArray
— Required table containing either a list of record identifiers to fetch or an array of tables containing record identifiers and zone details. Pass this value as follows:If zones are not being used, simply pass this value as a list of record identifiers (strings):
recordNameArray = { "r1", "r2", "r3" }
If zones are being used, pass this value as an array of tables containing record identifiers and zone details:
recordNameArray = { { recordName="r1", zoneName="z1", zoneOwner="o1" }, { recordName="r2", zoneName="z2", zoneOwner="o2" } }
onComplete
— Required listener function to be invoked with an iCloudRecordEvent for the overall fetch request.
onRecord
— Optional listener function to be invoked with an iCloudRecordEvent for each record in the fetch request.
database
— Optional string value indicating the database.
containerId
— Optional string value indicating a specific iCloud Container in which the record is contained. Do not pass this parameter if you have only one iCloud Container associated with your app.
-- Listener function to handle per-record events local function recordFetched( event ) print( event.record ) -- Specific fetched record print( event.isError ) -- Indicates whether an error occurred print( event.recordName ) -- If an error occurred, identifies the record involved print( event.error ) -- Description of the error which occurred, if any end -- Listener function to handle the overall fetch request local function fetchResults( event ) print( event.recordArray ) -- Array of successfully retrieved records print( event.isError ) -- Indicates whether an error occurred print( event.error ) -- Description of the error which occurred, if any end iCloud.recordFetchMultiple( { recordNameArray = { "r1", "r2", "r3" }, onRecord = recordFetched, onComplete = fetchResults } )