How to combine the hubdb and selection field

in the below code in the place of Athletics i need to add selection field or choice field, but it is showing syntax error

<div class=“sporteng-acs-outer”>
<div class=“pagecenter”>
<div class=“sporteng-acs-inner”>
<div class=“sporteng-acs-heading”>
<h2>
{{ module.case_studies_heading }}
</h2>
</div>
{% set case_data = hubdb_table_rows(module.hubdbtable_field, ‘sport_filter=Athletics&limit=3’) %}
<div class=“sporteng-acs-cards”>
{% for data in case_data %}
<div class=“sporteng-acs-repeater”>
<div class=“sporteng-acs-repeater-image” style=“background:url(‘{{ data.sport_image.url }}’);”>
</div>
<div class=“sporteng-acs-repeater-text-section”>
<div class=“sporteng-acs-repeater-title”>
<h3>
{{ data.title }}
</h3>
</div>
<div class=“sporteng-acs-repeater-overview”>
{{ data.description }}
</div>
<div class=“sporteng-acs-repeater-readmore”>
<a href=“{{ data.page_link }}”>
Read more >>>
</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>

Like so:

{% set queryparam = '&sport_filter__in=' ~ module.sport_type ~ '&limit=3' %}
{% set case_data = hubdb_table_rows(module.hubdbtable_field, queryparam) %}

Where module.sport_type is the id of your selection field. Use capitalize filter e.g. “module.sport_type|capitalize” if you’re not ensuring the values of the selection field are written in sentence case so they match the values from your HubDB.

Thank you its working..:blush:

but it is not working for all data it is case sensitive.

Yes, it is case sensitive

but in html how to make it incase sensitive

You have to match your HubL output with the HubDB values. So if all your values are first letter capitalised only e.g. “Athletics” or “High jump” (sentence case), then do

module.sport_type|capitalize

Depends how you’ve written your values in the HubDB.

in some row the first 3 letter is in capital in that condition it is not working.

Just match the values of the choice field in your custom module to the values in the HubDB, so specifically set the value to be “AFL” and it should work.

for Heigh lighted it is not working. and replace is also not working for & and ()

{% set queryparam = ‘&sport_filter=’ ~ module.choice_field|capitalize|replace(‘_’,’ ‘)|replace(’&‘,’') ~ ‘&limit=3’ %}
{% set case_data = hubdb_table_rows(module.hubdbtable_field, queryparam) %}

is it works only for capitalize, it is not working for upper or lower case

Then make the value of the “AFL” in the choice field “Afl” (the label can still be “AFL”).