# Controllable queryparam through choice field?

**URL:** <https://community.hubspot.com/t/controllable-queryparam-through-choice-field/24301>\
**Category:** CMS Development\
**Created:** [August 18, 2020, 10:41am UTC](https://community.hubspot.com/t/controllable-queryparam-through-choice-field/24301 "2020-08-18T10:41:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pm8rsh88](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pm8rsh88/32/78471_2.png) [@pm8rsh88](https://community.hubspot.com/u/pm8rsh88)\
**Post date:** [August 18, 2020, 10:41am UTC](https://community.hubspot.com/t/controllable-queryparam-through-choice-field/24301/1 "2020-08-18T10:41:13Z")

</div>

Hi,

I’m trying to build a Meet the Team module for our website. What I would like this module to do is sit on a page and only show a specific group of people. I have the database set up and the following code

`{% for row in hubdb_table_rows(module.mtt_table, queryparam) %}{% if loop.index <= 8 %}<div class="profile-box text-center"><span><a class="no-underline diamond-ie" href="{{ request.path }}/{{ row.hs_path }}"><img class="diamond" src="{{ row.featured_image.url }}" alt="{{ row.first_name }} {{ row.last_name }}"></a><h4>{{ row.first_name }} {{ row.last_name }}</h4><p>{{row.job_title}}</p><p><a href="mailto:{{ row.email }}">{{ row.email }}</a></p></span></div>{% endif %}{% endfor %}`

This works fine and displays all of our colleagues who have a profile set up in the HubDB.

In the HubDB, I have a column which is a multi-select “Expertise”. This holds information about what area our colleagues specialises in. In the module, I have set up a choice\_field which has the exact same selection options as the column “Expertise” in the HubDB (same order too).

What is the best way to set the queryparam based on the choice\_field selection?

Everything I have found so far only tells me how to add a filter than the user’s control, rather than the back end and per page.

---

<div class="post-metadata">

**Author:** ![pm8rsh88](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pm8rsh88/32/78471_2.png) [@pm8rsh88](https://community.hubspot.com/u/pm8rsh88)\
**Post date:** [August 18, 2020, 1:55pm UTC](https://community.hubspot.com/t/controllable-queryparam-through-choice-field/24301/2 "2020-08-18T13:55:40Z")

</div>

Finally got it to work. Turns out I was over complicating the matter.

I was trying to compare the value of the choice\_field to the injury ID. Instead, I threw a bunch of IF statements for each of the choice\_field options and that worked fine.

```auto
{% set queryparam = "&orderBy=order" %}
{% if module.choice_field == "1" %}
{% set queryparam = queryparam ~ "&expertise__contains=1" %}
{% endif %}

{% if module.choice_field == "2" %}
{% set queryparam = queryparam ~ "&expertise__contains=2" %}
{% endif %}

{% if module.choice_field == "3" %}
{% set queryparam = queryparam ~ "&expertise__contains=3" %}
{% endif %}

```

```auto
{% set table = hubdb_table_rows(1053024, queryparam)%}
{% for row in hubdb_table_rows(1053024, queryparam) %}{% if loop.index <= 8 %}<div class="profile-box text-center"><span><a class="no-underline diamond-ie" href="{{ request.path }}/{{ row.hs_path }}"><img class="diamond" src="{{ row.featured_image.url }}" alt="{{ row.first_name }} {{ row.last_name }}"></a><h4>{{ row.first_name }} {{ row.last_name }}</h4><p>{{row.job_title}}</p><p><a href="mailto:{{ row.email }}">{{ row.email }}</a></p></span></div>{% endif %}{% endfor %}

```

.
