Page 1 of 1

Combine DB query with dropdown list

Posted: Sat Dec 03, 2016 3:53 pm
by Dennis

Hi
How am I able, from one DB query, to also include the choice of a dropdown list?

In a before send mapping, I have for the query:

return '{"$and":[{"lminMin":{"$lte":"'+value+'"}},{"lminMax": {"$gte":"'+value+'"}},{"Weather":"Windy"}]}';

When I do it like this, it does the query, but only shows the ones with "Windy" in the DB.
I would like to make this dynamic, so that it would look in a dropdown and use the selected option instead. How is this possible?

Image

Image

Image


Combine DB query with dropdown list

Posted: Mon Dec 05, 2016 8:51 pm
by Serhii Kulibaba

Hello,

Please use JS below for such request:
prevar weather = Apperyio("weather_select").val();
return {"$and":[
{"lminMin":{"$lte":value}},
{"lminMax": {"$gte":value}},
{"Weather":weather}
]};
/pre
here weather_select - name of your dropdown component