• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
speed & reliability
#13
(08-14-2019, 04:29 PM)efrain.c Wrote: Hi sltfn,

Here is one way to use cdb_batchUpdate in your code:


global myVar
set itemDelimiter to tab

put "thisCustID" & tab & "thisFullName" & tab & "thisLastName" & tab & "thisBalance" & tab & "thisCode" & tab & "thisStatus" & tab & "thisRecordID" into theLineItems

put cdb_tableID("CUSTOMERS") into tTableID
put "cloud" into tTarget
set itemDelimiter to tab

repeat for each line DBrecordLine of myVar
 
  repeat with itemCount = 1 to (the number of items of theLineItems)
     do "put item" && itemCount && "of DBrecordLine into" && (item itemCount of theLineItems)
  end repeat
 
  put thisRecordID into tRecordID
  put thisCustID into tDataA[tTableID][tRecordID]["CUSTOMER_ID"]
  put thisFullName into tDataA[tTableID][tRecordID]["FULL_NAME"]
  put thisLastName into tDataA[tTableID][tRecordID]["LAST_NAME"]
  put thisBalance into tDataA[tTableID][tRecordID]["BALANCE"]
  put thisCode into tDataA[tTableID][tRecordID]["CODE"]
  put thisStatus into tDataA[tTableID][tRecordID]["STATUS"]
 
end repeat -- looping through each line of myVar

cdb_batchUpdate tDataA, tTarget


There are a couple changes to note. cdb_batchUpdate uses tableID instead of table name. tDataA is structured differently to allow updates across multiple records across multiple tables. cdb_batchUpdate is placed after the repeat, the repeat structures the data and cdb_batchUpdate sends all the updates as a single request.

Hope this helps. Let us know if you have any questions.

Thanks, efrain. This is very helpful. Now I just need to change some routines used earlier in my processing to work with batch updating and test. Much appreciated.
  Reply


Messages In This Thread
speed & reliability - by sltfn - 07-23-2019, 08:23 PM
RE: speed & reliability - by simon.schvartzman - 07-23-2019, 09:52 PM
RE: speed & reliability - by sltfn - 07-23-2019, 09:57 PM
RE: speed & reliability - by efrain.c - 07-24-2019, 01:05 AM
RE: speed & reliability - by clarencemartin - 07-24-2019, 03:41 AM
RE: speed & reliability - by sltfn - 07-25-2019, 05:39 PM
RE: speed & reliability - by mark_talluto - 07-25-2019, 09:35 PM
RE: speed & reliability - by sltfn - 08-13-2019, 12:17 AM
RE: speed & reliability - by mark_talluto - 07-25-2019, 09:38 PM
RE: speed & reliability - by mark_talluto - 07-26-2019, 11:56 PM
RE: speed & reliability - by simon.schvartzman - 07-28-2019, 09:38 PM
RE: speed & reliability - by efrain.c - 08-14-2019, 04:29 PM
RE: speed & reliability - by sltfn - 08-15-2019, 09:35 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)