Read more than one values from Variable in Filtering condtions

mustufam5967803

05-03-2020

I am trying to pass multiple values from a variable in JavaScript activity into filter condition next activity, however constantly getting an error saying 'res.getElementsByTagName is not a function'.

Can anyone please have a look and help with their valuable input.

The code I am using is:


var winner = xtk.queryDef.create(<queryDef schema="nms:delivery" operation="select">
<select>
<node expr="@id"/>
<node expr="@internalName"/>
<node expr="@state"/>
<node expr="@created"/>
</select>
<where>

<condition expr={("@state = '95' ")}/>

</where>
<orderBy>
<node expr="[@created]" sortDesc="true" />
</orderBy>
</queryDef>);

res = winner.ExecuteQuery();

var resultArray = new Array();

var result= res.getElementsByTagName("nms:delivery");

for each (var row in result)
{
resultArray.push("'"+row.getAttribute("@internalName")+"'");
//resultArray.push("'"+row.@internalName+"'");

}

vars.finalResult = resultArray.join(",").slice(1,2,3,4,5);

logInfo("The Internal Names are" + vars.finalResult);

Adobe Campaign Adobe Campaign Classic

Accepted Solutions (1)

Accepted Solutions (1)

Milan_Vucetic

MVP

05-03-2020

Hi @mustufam5967803 ,

 

why do not you iterate res variable immediately and use values?

 

for each (var row in res)
{
resultArray.push(row.@internalName);

}

 

Generally, you must convert output to the DOM object first in order to avoid error if I am not wrong:

res = winner.ExecuteQuery();

res = DOMDocument.fromXMLString(res);

and then to use

var result= res.getElementsByTagName("nms:delivery");

 

Regards,

Milan

 

Answers (0)