Dan Hoeck
Posts: 0
Joined: Sat May 17, 2014 3:55 am

query with two variables

Hi.

I'm trying to run a query that searches for a row containing 2 particular variables in 2 particular columns of the database.

Right now I am trying to do so by creating a 2nd "where" in the query Request. Then I map one variable to each "where" and run the query.

I could use some help setting up a query that finds all results that have particular words in 2 specific columns.

Thanks!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

query with two variables

Hello Dan,

Please look at this link:
http://devcenter.appery.io/documentat...

Dan Hoeck
Posts: 0
Joined: Sat May 17, 2014 3:55 am

query with two variables

I looked through that before but could not find out the proper mapping?

I was using the following, however the mapping won't work because the mapping does not dynamically separate which value I'm using to compare to userName and to vendorName.

return '{"$and": [{"userName": "'+value+'"},{"vendorName": "'+value+'"}]}';

should I use two "where" options under the request tab of the query?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

query with two variables

Hi Dan,

That's right, but please note it's better not to map two components to a request parameter. It's better to read values from localStorage variables or UI components. For example:
prevar vendorName = localStorage.getItem("vendorName");
var userName = Apperyio("userName ").val();
return '{"$and": [{"userName": "'+userName+'"},{"vendorName": "'+vendorName+'"}]}';/preWhere 'userName' is an Input component name,
'vendorName' is a localStorage variable name.

This is just an example. Replace it with the code you need.

Dan Hoeck
Posts: 0
Joined: Sat May 17, 2014 3:55 am

query with two variables

I had issues with pulling the existing variable, but did a workaround mapping the variable directly and calling the local storage variable.

Thanks for your help!

Agustin Gosende
Posts: 0
Joined: Fri Mar 13, 2015 8:52 pm

query with two variables

Hi, I have a similar problem:

http://gsfn.us/t/4s8u3

Any idea?

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

query with two variables

Hello Augustin,

We are working on it and will post an update in the corresponding thread.

Dave7972340
Posts: 0
Joined: Thu Jan 07, 2016 8:48 pm

query with two variables

Dan,

Could you let me know what you did for your workaround mapping?

Thanks,

Dave

Return to “Issues”