How to use event variables/instance variables in JS code where clause | Community
Skip to main content
akashaj7696
Level 3
March 21, 2021
Solved

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

  • March 21, 2021
  • 1 reply
  • 1748 views

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

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 akashaj7696

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+"'"}/>.

 

 

1 reply

akashaj7696
akashaj7696AuthorAccepted solution
Level 3
March 22, 2021

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+"'"}/>.