Pulling all relevant results from HubDB Multi-Select

Hey there, I’m trying to filter and display results from a HubDB table. I’ve followed this tutorial with much success: GitHub - HubSpot/cms-custom-objects-example · GitHub

However, I ran into an issue when trying to query the table for all rows that contain and certain value in their Multi-Select. I’m using “&categories=<multi-select-option-id>” as my parameters, and it is succeessfully pulling rows that have the specific option selected. I run into the problem with rows that have more than one option selected in the multi-select though.

{# paramaters #}

{% set queryparam = queryparam ~ “&categories=”~request.query_dict.categories|urlencode %}

{# Query #}

{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id, queryparam)|sort(False, False, ‘name’) %}

Ex: “Dropship” is the 4th option in the multiselect. So if I use “&categories=4” as my parameters, all of the rows that have only “Dropship” selected in the multi-select will be returned, excluding those that have “Dropship” and others selected.

Does anyone know how to expand these paramaters to check if the desired option is listed among a multi-select that has multiple options selected?

Nevermind! I was able to find I solution by comparing their ids using

{% for category in row.categories %}
{% if category.id == request.query_dict.categories%}

…

{% endif %}

{% endfor %}

You have an easy solution if you add this sufix to your variable: __contains=