How to retrieve values for the variable name and variable expression fields defined within delivery properties | Community
Skip to main content
Level 2
November 6, 2023
Solved

How to retrieve values for the variable name and variable expression fields defined within delivery properties

  • November 6, 2023
  • 1 reply
  • 1337 views

Hi Team,

I would like to retrieve values for the variable name ([variables/var/@name]) and variable expression ([variables/var/expr]) fields stored in the nms:delivery schema using a queryDef. I have tried the following code. I am able to view the XML data for deliveryContent but d.varName and d.varExpr are blank:

 

var deliveryContent = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="select">
<select>
<node expr="[variables/var/@name]" alias="varName"/>
<node expr="[variables/var/expr]" alias="varExpr"/>
</select>
<where>
<condition expr = {"@id = '1000'"} />
</where>
</queryDef>
).ExecuteQuery();

logInfo("Variable XML: "+deliveryContent);

for each(var d in deliveryContent){
logInfo("Var Name: "+d.varName);
logInfo("Var Expr: "+d.varExpr);
}

 

Can anyone please help me populate the values for the above fields? Thank you in advance.

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 ParthaSarathy

Hi @anushka_rk ,

Use the below script, it will print varName and varExpr:

 

var query = xtk.queryDef.create( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="[variables/var/@name]" alias="varName"/> <node expr="[variables/var/expr]" alias="varExpr"/> </select> <where> <condition expr = {"@id = '123456'"} /> </where> </queryDef> ); var record = query.ExecuteQuery(); for each (var d in record) { logInfo("vars.varName"+d.variables.varName); logInfo("vars.varExpr"+d.variables.varExpr); }

 

1 reply

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
November 7, 2023

Hi @anushka_rk ,

Use the below script, it will print varName and varExpr:

 

var query = xtk.queryDef.create( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="[variables/var/@name]" alias="varName"/> <node expr="[variables/var/expr]" alias="varExpr"/> </select> <where> <condition expr = {"@id = '123456'"} /> </where> </queryDef> ); var record = query.ExecuteQuery(); for each (var d in record) { logInfo("vars.varName"+d.variables.varName); logInfo("vars.varExpr"+d.variables.varExpr); }

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
November 7, 2023

Hi @parthasarathy 
It worked. Thank you.

Kind Regards,

Anushka