Page 1 of 1

query with two variables

Posted: Wed Jun 11, 2014 7:44 pm
by Dan Hoeck

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!


query with two variables

Posted: Wed Jun 11, 2014 8:17 pm
by Evgene Karachevtsev

Hello Dan,

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


query with two variables

Posted: Wed Jun 11, 2014 9:23 pm
by Dan Hoeck

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?


query with two variables

Posted: Thu Jun 12, 2014 12:26 pm
by Kateryna Grynko

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.


query with two variables

Posted: Tue Jun 17, 2014 11:23 pm
by Dan Hoeck

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!


query with two variables

Posted: Wed Sep 09, 2015 9:32 pm
by Agustin Gosende

Hi, I have a similar problem:

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

Any idea?

Thanks


query with two variables

Posted: Thu Sep 10, 2015 5:12 am
by Evgene Karachevtsev

Hello Augustin,

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


query with two variables

Posted: Mon Mar 07, 2016 9:32 pm
by Dave7972340

Dan,

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

Thanks,

Dave