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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @bhaskarc1289447 

 

The correct syntax is

$(instance/vars/@myVariable)

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @bhaskarc1289447 

 

The correct syntax is

$(instance/vars/@myVariable)

 

Avatar

Level 3

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

Avatar

Community Advisor

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.

 

Avatar

Level 3

hi @Manoj_Kumar_ 

 

I have a webapp where user can search multiple options as  search criteria, which we are saving as comma separated and we are using query activity to pull the data. since its multiple options against a same criterea as i mentioned in the example, we need to use included in n it doesn't pick any data

 

we are planning to use javascript but javascript querydef but it picks only 10000 records

 

The second issue is
The is a 'time' filed in format hh:mm:ss in schema.  we are storing time parameter in as a string in an instance variable(instance.vars.timeVariable) and comparing with the time field but its not working

 

TimeLastRun ---> is equal to --> $(instance/vars/@timeVariable)

@Manoj_Kumar_  please help!!