Page 1 of 2

Multiple dependent variable query

Posted: Sat May 31, 2014 10:34 pm
by chris huert

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.


Multiple dependent variable query

Posted: Sun Jun 01, 2014 12:10 am
by Igor

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...


Multiple dependent variable query

Posted: Sun Jun 01, 2014 8:32 pm
by chris huert

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


Multiple dependent variable query

Posted: Mon Jun 02, 2014 9:14 am
by Evgene Karachevtsev

Hello Chris,

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


Multiple dependent variable query

Posted: Mon Jun 02, 2014 2:58 pm
by chris huert

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}]}


Multiple dependent variable query

Posted: Tue Jun 03, 2014 12:56 am
by chris huert

Is there an issue with the JS?

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


Multiple dependent variable query

Posted: Tue Jun 03, 2014 12:57 am
by Alena Prykhodko

Hello Chris,

Is it automatically or manually created service?


Multiple dependent variable query

Posted: Tue Jun 03, 2014 1:04 am
by chris huert

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.


Multiple dependent variable query

Posted: Tue Jun 03, 2014 1:05 am
by chris huert

It is manual. Invoked upon clicking a button


Multiple dependent variable query

Posted: Tue Jun 03, 2014 1:06 am
by chris huert

It is manual. Invoked upon clicking a button