function cdb_batchCreate(pInputA)


Summary

This function allocates new cdbRecordIDs and stores provided data for a batch of records across one or more tables.

Inputs

*optional parameter.

BatchCreate input diagram

Outputs

(Array) -- This output array has similar structure to the input array, except that the indexKeys has the cdbRecordID as a child key. The corresponding cdbRecordID keys have empty contents.

BatchCreate output diagram

Additional Requirements

This API call requires internet access if the 'cloud' option is selected

API Version

Examples

local tInputA, tOutputA, tClientsTableID, tOfficeTableID

# Table name: clients
# Keys: firstName, lastName, age, income
put cdb_getTableID("clients") into tClientsTableID

# Table name: office
# Keys: name, address
put cdb_getTableID("office") into tOfficeTableID

put "John" into tInputA[tClientsTableID]["a"]["firstName"]
put "Smith" into tInputA[tClientsTableID]["a"]["lastName"]
put "47" into tInputA[tClientsTableID]["a"]["age"]
put "100000" into tInputA[tClientsTableID]["a"]["income"]

put "Jenny" into tInputA[tClientsTableID]["b"]["firstName"]
put "Smith" into tInputA[tClientsTableID]["b"]["lastName"]
put "47" into tInputA[tClientsTableID]["b"]["age"]
put "100000" into tInputA[tClientsTableID]["b"]["income"]

put "Smith's Tech" into tInputA[tOfficeTableID][1]["name"]
put "123 office road" into tInputA[tOfficeTableID][1]["address"]

put "cloud" into tInputA["cdbTarget"]

put cdb_batchCreate(tInputA) into tOutputA

# output array: 
# tOutputA[tClientsTableID]["a"] - "12345678-abcd-1234-cdef-1234567890ab"
#                                  CDBRecordID for John Smith
#                          ["b"] - "87654321-abcd-1234-cdef-1234567890ab"
#                                  CDBRecordID for Jenny Smith
#         [tOfficeTableID][1] - "45678123-abcd-1234-cdef-1234567890ab"
#                                CDBRecordID for Smith's Tech