Expand my Community achievements bar.

Join us for Adobe Campaign Community Q&A Coffee Break on Thursday, March 7th at 8am PT with Eric Perrin, Gael Mouello, Chakravarthy Kalva, Bruce Swann and Sandra Hausmann.
SOLVED

keep the results of interim population between two executions - How to monitor and turn off with a work flow

Avatar

Level 4

We have discovered that our campaign users routinely set the "keep the results of interim population between between two executions" for campaigns, hypothesis and technical work flows.  This can causes issues with DB disk usage so we would like to create a technical work flow to monitor for this setting and turn it off.

 

I can see the the event table contains "KeepResult" which allows us to identify campaigns etc which have been run with this setting on but the information is historical and not necessarily the current setting for the campaign.

 

Is there a way to check the current setting for "keep the results of interim population between between two executions" for a campaign/hypothesis/work flow and update this setting through an automated process?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Ken_Qrious ,

Yes you can achieve this by creating a workflow.

ParthaSarathy_0-1699342844666.png

 

Schedule to run the Workflow weekly once.

JavaScript Code:

var sevenDaysAgo = new Date();
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
sevenDaysAgo = formatDate(sevenDaysAgo, "%2M/%2D/%4Y %2H:%2N:%2S");

var query = xtk.queryDef.create(
<queryDef schema="xtk:workflow" operation="select">
<select>
  <node expr="@id"/>
  <node expr="@lastModified"/>
  <node expr="@keepResult"/>
  <node expr="@showSQL"/>
</select>
<where>
  <condition expr={"@lastModified <'"+ sevenDaysAgo +"'"}/>
</where>
</queryDef>
);
var record = query.ExecuteQuery();
for each (var variable in record) {
if(variable.@keepResult == true){
var primaryKey = variable.@id;
var keepInterimResult = 0;
xtk.session.Write(<workflow xtkschema="xtk:workflow" _operation="update" id={primaryKey} keepResult={keepInterimResult} />);
}
if(variable.@showSQL == true){
var primaryKey = variable.@id;
var showSqlLogs = 0;
xtk.session.Write(<workflow xtkschema="xtk:workflow" _operation="update" id={primaryKey} showSQL={showSqlLogs} />);
}
}
Now When the workflow run, All the "keep the results of interim population between between two executions" and 'Log SQL queries in the journal' will be unchecked automatically.

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @Ken_Qrious ,

Yes you can achieve this by creating a workflow.

ParthaSarathy_0-1699342844666.png

 

Schedule to run the Workflow weekly once.

JavaScript Code:

var sevenDaysAgo = new Date();
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
sevenDaysAgo = formatDate(sevenDaysAgo, "%2M/%2D/%4Y %2H:%2N:%2S");

var query = xtk.queryDef.create(
<queryDef schema="xtk:workflow" operation="select">
<select>
  <node expr="@id"/>
  <node expr="@lastModified"/>
  <node expr="@keepResult"/>
  <node expr="@showSQL"/>
</select>
<where>
  <condition expr={"@lastModified <'"+ sevenDaysAgo +"'"}/>
</where>
</queryDef>
);
var record = query.ExecuteQuery();
for each (var variable in record) {
if(variable.@keepResult == true){
var primaryKey = variable.@id;
var keepInterimResult = 0;
xtk.session.Write(<workflow xtkschema="xtk:workflow" _operation="update" id={primaryKey} keepResult={keepInterimResult} />);
}
if(variable.@showSQL == true){
var primaryKey = variable.@id;
var showSqlLogs = 0;
xtk.session.Write(<workflow xtkschema="xtk:workflow" _operation="update" id={primaryKey} showSQL={showSqlLogs} />);
}
}
Now When the workflow run, All the "keep the results of interim population between between two executions" and 'Log SQL queries in the journal' will be unchecked automatically.

Avatar

Level 4
One additional question. When this setting is changed is the data storage released or does the workflow need to be rerun with the setting set off to release the data storage?

Avatar

Community Advisor

@Ken_Qrious, no need to re-Run the workflow again.

In Workflow property > Execution (Tab) you can see History in days. If it is 7, those temporary data will get released automatically.

Capture.PNG

 

Avatar

Level 4
Thanks Partha for the comment regarding release of the data storage after the keep results flag is set off.