Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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);
}

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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);
}