How to create and remove a temporary schema in Campaign | Community
Skip to main content
December 27, 2019
Solved

How to create and remove a temporary schema in Campaign

  • December 27, 2019
  • 2 replies
  • 4286 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Krish829

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

2 replies

Jonathon_wodnicki
Community Advisor
Community Advisor
December 30, 2019

Hi,

 

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

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

 

Thanks,

-Jon

Level 2
January 14, 2020

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

Krish829
Krish829Accepted solution
Level 2
January 2, 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