my code to get the content of personalization block :
var personalizationBlock = NLWS.xtkQueryDef.create(
<queryDef schema="nms:includeView" operation="select">
<select>
<node expr="[source/text]" allias="script"/>
</select>
<where>
<condition expr = {"@name = "+strSender+" "} />
</where>
</queryDef>
);
var res = personalizationBlock.ExecuteQuery();
logInfo("Script: "+res.toXMLString());
var test= res.getElementsByTagName("source")[0].getElementsByTagName("text").data;
logInfo("test : "+test);
I am getting the query response as below:
<includeView-collection>
<includeView>
<source>
<text>
<![CDATA[my script here]]>
</text>
</source>
</includeView>
</includeView-collection>
I need to get the script without the CDATA which is coming undefined now.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @melinam63825268 ,
First you have a typo in your query, 'alias' is with one 'l' not two.
Try with the code below :
var personalizationBlock = NLWS.xtkQueryDef.create(
<queryDef schema="nms:includeView" operation="select">
<select>
<node expr="[source/text]" alias="script"/>
</select>
<where>
<condition expr = {"@name = '"+strSender+"'"} />
</where>
</queryDef>
);
var res = personalizationBlock.ExecuteQuery();
var data = res.getFirstElement("includeView").getValue("script");
logInfo("data : "+data);
Br,
Amine
Hello @melinam63825268 ,
First you have a typo in your query, 'alias' is with one 'l' not two.
Try with the code below :
var personalizationBlock = NLWS.xtkQueryDef.create(
<queryDef schema="nms:includeView" operation="select">
<select>
<node expr="[source/text]" alias="script"/>
</select>
<where>
<condition expr = {"@name = '"+strSender+"'"} />
</where>
</queryDef>
);
var res = personalizationBlock.ExecuteQuery();
var data = res.getFirstElement("includeView").getValue("script");
logInfo("data : "+data);
Br,
Amine
Thanks a lot :). it worked .
Views
Likes
Replies