Avatar

Level 4

Hello @montezh2001,

 

montezh2001_0-1647280472383.png

I see two issues in your xtk.session.Write, the "vars.targetSchema" should be " {vars.targetSchema.split(':')[1]} ", and the identifier used to update your rows. As i understand from your request, the identifier of your temporary table is "clientId" and not "id", so your script should look like this :

var query = xtk.queryDef.create(
              <queryDef schema={vars.targetSchema} operation="select">
                <select>
                  <node expr="@clientId"/> //or any identifier of the workflow's temporary table
                  <node expr="@contractIssueDate"/>
				  <node expr="@MMMYYYYDate"/>
                </select>
                </queryDef>);
				
				
var results = query.ExecuteQuery();


for each( var tmp in results){
  var res = tmp.@contractIssueDate;
  var Date1 = formatDate(res,"%B%Y").toString();
  
  logInfo("MMMDate: "+Date1);
  
  xtk.session.Write(<{vars.targetSchema.split(':')[1]} _operation="update" _key="@clientId" xtkschema={vars.targetSchema} clientId={tmp.@clientId} MMMYYYYDate={Date1}/>); 
}

Br,

 

Amine