Mass/Batch Update using xtk.session.write

r93

08-08-2016

Hi guys,

I am currently have a workflow containing a Javascript activity which is querying several data schemas such as nms:broadLogRcp and nms:trackingLogRcp to select

recipients and then query the result using xtk.queryDef.create function. After being able to query the results, I am writing to the nms:recipient schema, populating a field attribute on that table FOR EACH RECIPIENT in the schema  using xtk.session.write function. 

However as there is a large set of data involved and large number of recipients, this process is taking a very long time as I will have to loop through each recipient, then do the update which will populate the field in the data schema for each recipient. So i wanted to know if it is possible doing a batch/mass update using the xtk.session api. I am unable to do this in SQL due to not having the rights to perform SQL queries in the adobe campaign environment I am working in hence why I am using xtk.queryDef.

To make it simple, All i am doing is:

  • selecting recipients from both nms:broadLogRcp & nms:trackingLogRcp tables (using xtk.queryDef.create)
  • querying the results(using the ExecuteQuery function)
  • A For each loop to iterate through all recipients
  • Then using conditional statements to assign recipients a flag - This is when I am writing to the nms:recipient schema to populate field with the flag assigned for each recipient that has been iterated.

I would like to know how I can perform or it will be possible do a batch update on this which will reduce time in setting flags for all recipients. I know there is an Update Data activity available in the workflow but need to do this through javascript which is needed  for doing aggregate counts for each recipient.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Linda_Stinson

Employee

16-09-2016

Note that you should not use the APIs to add large numbers of records to the database. In that case you are better to use file-based import.

Linda

Answers (6)

Answers (6)

Linda_Stinson

Employee

03-01-2018

Hi Nadeem,

If they are hosted then their contract is likely to state a limit on the volume of API calls, but in general the APIs are not designed to handle these types of volumes that are better handled through a data file.

Linda

nadeema90078524

19-12-2017

Hi Linda ,

When you talk about large numbers of records . How large it can be . In similar request i have to write around 35k records on hourly basis. Will  that be ok ?

Thanks

Nadeem

Linda_Stinson

Employee

06-09-2016

Also, you should be able to use Data Management techniques in the workflow to calculate the aggregates and then use UpdateData as you mentioned. Have you taken the Data Management training course?

Linda

Linda_Stinson

Employee

06-09-2016

Hi Rohan,

You can use the WriteCollection method on xtk:session. Here is an example, but I have not confirmed that it works as written:

<recipient-collection xtkschema="nms:recipient"> 

  <recipient email="john.doe@adobe.com" firstName="John" lastName="Doe" _key="@email"/>

<recipient email="peter.martinez@adobe.com" firstName="Peter" lastName="Martinez" _key="@email"/>

  <recipient ...

</recipient-collection>

This is from the documentation:

Data oriented APIs

Linda

John_T_Smith

08-08-2016

Please post the name of the program you use so a Moderator may move this message to the correct program forum

This forum is not about help with programs... a program would be Photoshop or Dreamweaver or Muse or ???