Expand my Community achievements bar.

SOLVED

Mass/Batch Update using xtk.session.write

Avatar

Level 1
Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

7 Replies

Avatar

Level 2

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 ???

Avatar

Level 1
Level 1

I am using Adobe Campaign also known as neolane to do this

Avatar

Employee

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

Avatar

Employee

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

Avatar

Correct answer by
Employee

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

Avatar

Level 2

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

Avatar

Employee

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