Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

Hi,
can I ask you what is the best way to approach this. I could use "where" request but I dont see a way to do this with miltiple "wheres"

Its a search in a property rental app.
Below are screenshot of db and ui

in the ui I have 4 selectmenus
1 choose area
2 choose No of bedrooms
3 choose price range. (between 500 and 750 for eg)
4 Profession

What I am trying to achieve is to end up with an array

(of results of queries for eg. all 2 bed properties in a certain town with rent price between 500-750 suitable for profrssionals)

and be able to map the resulting array to a grid in the ui

Image

Image

thx inadvance

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

multi query

Hi Michael,

I'm afraid the multiple 'where' requests could be implemented with several services for each query.
But I will check it additionally with our developers, maybe there is a much better implementation of this case.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

Thanks alot lllya, i didnt want to spend lots of time if my logic was not correct

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

multi query

Hello Michael,

There is documents about multiple where clauses: http://devcenter.appery.io/documentat...

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

Hi Evgene,
I had read that, however I am still a bit lost, lllya suggested there may be a better way?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

multi query

Hi Michael, the most efficient way is to use $or and $and operators with 'where' clause.

Please describe where exactly you're having troubles with how to use it? Or show us some examples that you've tried and the parts where you want to make them in efficient way?

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

Hi lllya,
I haven't started as I am unsure of how to implement.

Im struggling to figure out how to map the values of 4 selectmenus to the "where" Paramater

or do I need the values saved to localstorage and use js in mapping to add the $or and $and?

i could do it long way by doing a where for each select and eventually get the results to map to the ui but that looks wrong and slow.

If u have an example that would help alot

thanks folks

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

Hi,
am I on thre right track with this code, for a multi where from selectmenus

where Mapping code
codevar locationSelect = Apperyio("locationSelect ").val();
var bedroomSelect = Apperyio("bedroomSelect ").val();
var priceSelect = Apperyio("priceSelect ").val();
var professionSelect = Apperyio("professionSelect ").val();
return '{"$and": [{"locationSelect": "'+locationSelect+'"},{"bedroomSelect": "'+bedroomSelect'"},{"priceSelect": "'+priceSelect'"},{"professionSelect": "'+professionSelect'"}]}';/code

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

I have tried the above code in where mapping, working on test tab,

error on console

Image

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

multi query

some screenshots, my code is wrong

Image Image Image Image

Return to “Issues”