Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to create and remove a temporary schema in Campaign

davidjgomez
Level 1
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
Krish829
Correct answer by
Level 1
Level 1

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
Jonathon_wodnicki
Community Advisor
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

ovot
Level 2
Level 2

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

Krish829
Correct answer by
Level 1
Level 1

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