Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How to use event variables/instance variables in JS code where clause

akashaj7696
Level 3
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
akashaj7696
Correct answer by
Level 3
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
akashaj7696
Correct answer by
Level 3
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