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 use event variables/instance variables in JS code where clause

Avatar

Level 3

Hi Everyone,

 

I am trying to write a queryDef code where in I want to filter the records based on the internalName of the previously executed delivery dynamically. Something like below-

 

var query=xtk.queryDef.create(

<queryDef schema="nms:delivery" operation="select"/>

<select>

<node expr="@id"/>

</select>

<where>

<condition expr="@internalName='DM123456' "/>

</where>

</queryDef>.ExecuteQuery();

 

In the above code the "DM123456" i want it to dynamic to an instance/event variable which i can create before.

 

Can someone please help, it will be great if it's possible.

 

Whatever solutions can be provided is highly appreciated.

 

Thanks,

Akash

1 Accepted Solution

Avatar

Correct answer by
Level 3

I found the solution myself-

so for using event variable the syntax is below-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+vars.internalName+"'"}/>

for instance variable-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+instance.vars.internalName+"'"}/>

for a user defined variable, let's say var internalName-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+internalName+"'"}/>.

akashaj7696_0-1616395661797.png

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

I found the solution myself-

so for using event variable the syntax is below-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+vars.internalName+"'"}/>

for instance variable-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+instance.vars.internalName+"'"}/>

for a user defined variable, let's say var internalName-

<condition boolOperator="AND" expr={"[delivery/@internalName] = '"+internalName+"'"}/>.

akashaj7696_0-1616395661797.png