How to create and remove a temporary schema in Campaign

davidjgomez

27-12-2019

Hello!

 

We have a requirement to create a temporary schema (maybe through a Javascript activity in the Workflow), use it and at the end of the execution remove this schema since it is only used there. 

 

I have this script:

var res = xtk.queryDef.create(
  <queryDef schema="mcc:SiteBrand" operation="select">
       <select>
         <node expr="@siteName"/>
       </select>
       <where>
         <condition expr={"@IsBounceX='Yes'"}/>
       </where>
</queryDef>).ExecuteQuery();

for each(var result in res) {
  xtk.session.Write(<TempMarkets xtkschema="temp:TempMarkets" 
    _operation="insert" siteName={result.@siteName} />);
}

 

So I want to use this "TempMarkets" in the following activities and then remove it. This is to pass some information that is going to be completed in some other activities and used at the end of the workflow.

 

I'm doing this since the only things I can pass through vars are Numbers, Strings and Dates and I wanted to pass an array of objects.

 

I haven't found any documentation on how to do this (especially removing it after been used). Would somebody help me know how to do this?

 

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

krishnag5769550

01-01-2020

Hi,

 

You can store data of temp:TempMarkets into a list and utilize it where u want. As your campaign execution end you also remove list from use.

 

Regards,

Krishna

Answers (1)

Answers (1)

wodnicki

MVP

30-12-2019

Hi,

 

There are undocumented functions available to manipulate temp tables: registerSchema(), buildSqlTable().

Usage example in nms:wkfSurvey.js, function readSurvey_call().

 

Thanks,

-Jon