Gilbert Gomez
Posts: 0
Joined: Sat Sep 07, 2013 2:35 am

How to use the Query service

Hi, how are you.
I'm sorry to bother you but I need a little help... well here is my story

I have a List control with some divisors to group five different sets of services that I want to read from a database ..I am not an expertise programmer ...so I am trying to create a simple “Query service” thru the local system, but I have no idea about how to do it. I’ve read already the community's docs, but is too confuse and don’t find anything similar to my need ..there is a tutorial to do this with more simple steps?

I just want to my app be able to read the complete list of rows and present on the “List control” just those with certain value at one specific Column, something like:

SELECT * FROM mydatabase WHERE column3="5" ORDER BY column1

Thanks

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to use the Query service

Where are you reading the list from?

Gilbert Gomez
Posts: 0
Joined: Sat Sep 07, 2013 2:35 am

How to use the Query service

Hi Max.. how are you? ..Thanks for answer
Well I created a new collection with the "database tag" and I added some rows with information about different options of lodging services in town. Then I returned to the design view and with this new page ...I dragged&dropped a “List Control” with five dividers and 1 item per each. So, in each item I put a “Label” ..to write the hotel's name on it ...which I hope to get with one "Query service"

But here is the trick ...The app should read the rows and separate them according with one of five criterias.
1) beachfront
2) ocean view
3) close to the beach
4) cheap
5) downtown

..I'm thinking on have a second query option to seperate the same lodging service by luxury resorts, great tourism, 4 stars, Villas ...So people could chose what they really need.

But ..How can do this avoiding to use javascript as possible? ..or if it is completly necesary what would be the easy way.

Again, thanks Max

PD. I let you some pics so you can get better idea about what trying to say
Have a good day. Image Image Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to use the Query service

Hello! To select from collection data with this condition column3="5" in Query service in mapping for request parameter "where" set code{"column3": "5"}/code
If you need to specify few conditions "where" parameter value would be code{"column3": "5", "column4": true}/code
For request to DB the same syntax is used as for MongoDB
This link might also help

Gilbert Gomez
Posts: 0
Joined: Sat Sep 07, 2013 2:35 am

How to use the Query service

Thank Marina for reply to my question.

Your links really helped me to set my data map, but I still have this trouble with my queries. I got some results ...but unfortunately are wrong ...I created a new REST Services and on its request tab added a "WHERE" as parameter with this value: {"hotelCategory":"5"}

..But when I run a Test the app gets all the rows as result... So I tried the same instruction with the "Run Query button" from the "Databases tab" ..and as you can see in the pics attached ...I got the real result ..just one row.

..What am I doing wrong?

Thank again
Have a nice evening Image Image Image Image

Sergey Kozyr
Posts: 0
Joined: Tue Apr 30, 2013 2:55 pm

How to use the Query service

Hello.
Please make sure that "where" request parameter has "Header" checkbox unticked.

Gilbert Gomez
Posts: 0
Joined: Sat Sep 07, 2013 2:35 am

How to use the Query service

Sergey you were right ..I just uncheck the parameter and it works perfectly
Thank all of you guys for you help and your time..

Return to “Issues”