Expand my Community achievements bar.

SOLVED

How to create and remove a temporary schema in Campaign

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Level 2

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

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

 

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

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

 

Thanks,

-Jon

Avatar

Level 2

Hi @Jonathon_wodnicki , would you mind expanding a little bit on what registerSchema and buildSqlTable do? Thanks!

Avatar

Correct answer by
Level 2

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