How to pass an instance variable captured in JavaScript to query activity | Community
Skip to main content
bhaskarc1289447
Level 3
March 31, 2022
Solved

How to pass an instance variable captured in JavaScript to query activity

  • March 31, 2022
  • 1 reply
  • 1618 views

Hi 

 

I have an variable and i want to pass it to a query. For my variable instance.vars.myVariable, i am using $(instance/vars/myVariable) but its not workingi n the query. I also tried assigning vars.myVariable and use $(vars/myVariable) in query and again that is not working. If we use $([instance/vars/myVariable ]) it shows error.

Kindly help

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 Manoj_Kumar

Hello @bhaskarc1289447 

 

The correct syntax is

$(instance/vars/@myVariable)

 

1 reply

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
March 31, 2022

Hello @bhaskarc1289447 

 

The correct syntax is

$(instance/vars/@myVariable)

 

Manoj  | https://themartech.pro
bhaskarc1289447
Level 3
April 5, 2022

Thank you @_manoj_kumar_ 

 

In myVariable, it has comma separated data. Example:  apple,orange,banana

 

when I use the query activity

 

fruits ---> is included in --> $(instance/vars/@myVariable), I am getting zero results. 

 

is it possible to use 'is included in' with $(instance/vars/@myVariable) in query activity or there is any alternate way to do that as myVariable will always have more that 2-3 data.

 

also there are multiple query conditions together. For example :

       fruits ---> is included in --> $(instance/vars/@myVariable)

and vegetables ---> is included in --> $(instance/vars/@myVariable2)

 

please help

Manoj_Kumar
Community Advisor
Community Advisor
April 6, 2022

Hello @bhaskarc1289447 

 

Yes, it won't work with is included in operator.

 

Can you explain your use case? May be there is another way to do it.

 

Manoj  | https://themartech.pro