- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
HubDB filter if statement help
Feb 8, 2018 11:13 AM
I am having a hard time trying to figure out how to write a couple different if statement for two filters in a HubDB custom module. Any help would be appreciated.
I have a two filters...
Type of Event = Event ("1)", Webinar ("2")
Location of Event = Minnesota ("1"), Wisconsin ("2"), Colorado ("3"), Iowa ("4"), North Dakota ("5")
If someone chooses "Show All" OR "Webinar" for the "Type of Event" and any of the options for the "Location of Event", I want all of the webinars to show up. The webinars are not location specific, so I want all of them to show up in the search results unless the "Type of Event" is selected as "Event."
Here are the current if statements I have in place that do not address this...
<!-- sets the different query parameters using submitted input for hubdb query -->
{% set typequery = "&orderBy=event_date_start" %}
{% if request.query_dict.type in ["1", "2"] %}
{% set typequery = typequery ~ "&type="~request.query_dict.type|urlencode %}
{% endif %}
{% if request.query_dict.type == "show-all" %}
{% set typequery = typequery %}
{% endif %}
{% set locationquery = "&orderBy=event_date_start" %}
{% if request.query_dict.location in ["1", "2", "3", "4", "5"] %}
{% set locationquery = locationquery ~ "&location="~request.query_dict.location|urlencode %}
{% endif %}
{% if request.query_dict.location == "show-all" %}
{% set locationquery = locationquery %}
{% endif %}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content