chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

Hello – I am building a search page but ran into some trouble. There are two components to the search portion page - an input search (store name) and a drop down (city name). I am trying to create it so that when a city name is selected from the drop down, it will only return store names in that city. The input search works perfectly, however I cannot figure out how to set it so that is only displays results of the selected city from the drop down.

Is there anything in the tutorials that demonstrates how to perform a search with multiple dependent variables? Any guidance would be sincerely appreciated.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Multiple dependent variable query

Hello,

You can save values to the localStorage variables and use this variables in the service request tab - where clause- Add JS.

Below links may be helpful:

http://devcenter.appery.io/documentat...
http://devcenter.appery.io/documentat...

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

Hello,

Thank you for getting back to me. Here is what I have attempted and it is still not working.

I have created the service, added it to the page, and added the below JS in the where clause. I did not map it on the request tab per the documentation's instructions. On the response tab, I mapped it to a grid component. I have invoked the service so that the query runs when I click on the search button, but nothing happens.

input component = searchinput_1
drop down component = dropdown_1

Here is the JS:

return '{"$and":[{"StoreName":"' + ("searchinput_1").val()+'"},{"MetroArea":' + (("dropdown_1").val()) + '}]}';

Is there something that I am missing? I created the values for the MetroArea drop down manually instead of invoking a service to have it populate to increase performance. zin an effort to troubleshoot, I tried having the drop down values invoked and then running the above JS, still nothing. Anything to assist would be sincerely appreciated.

Thank you

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

Multiple dependent variable query

Hello Chris,

Please clarify, have you tested your application with developer console? Do you have any errors there?
http://devcenter.appery.io/documentat...

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

No, no errors on the developer console. When I run the below test it works perfectly. However, when I enter the expanded code into the where clause, nothing returns. I tried switching it to "$or" just to test it, and nothing

{"$and":[{"StoreName":"student_searchinput_1"},{"MetroArea":dropdown_1}]}

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

Is there an issue with the JS?

return '{"$and":[{"StoreName":"' + ("searchinput_1").val()+'"},{"MetroArea":' + (("dropdown_1").val()) + '}]}';

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Multiple dependent variable query

Hello Chris,

Is it automatically or manually created service?

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

1) There are no errors displaying in the developer console.

2) When I test the service in the query service using {"$and":[{"StoreName":"student_searchinput_1"},{"MetroArea":dropdown_1}]} it responds correctly.

When I add the JS - return '{"$and":[{"StoreName":"' + ("searchinput_1").val()+'"},{"MetroArea":' + (("dropdown_1").val()) + '}]}'; to the where clause on the request tab, invoke the service, and then test the app - nothing. It does not return any values.

I am completely lost with what I am doing wrong.

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

It is manual. Invoked upon clicking a button

chris huert
Posts: 0
Joined: Sat May 31, 2014 10:34 pm

Multiple dependent variable query

It is manual. Invoked upon clicking a button

Return to “Issues”