Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

Combine DB query with dropdown list

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Combine DB query with dropdown list

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

Return to “Issues”