CMS Development

JZielińska
メンバー

Filtering HB database with multiple queryparams

Hello

I have a problem, in my template I'm filtering data from HB database

{% for row in hubdb_table_rows(module.hubdbtable_field, queryparam) %}

As queryparam: "&services__contains=digital&limit=2&orderBy=-date"

but it doesn't work. 

this &limit=2&orderBy=-date sets limit and order correctly
it looks like this part &services__contains=digital is not filtering by values in services column.

This is what this column looks like in database, so all names are correct.

JZieliska_0-1642507466073.png

Why the queryparam doesn't filter by the services column? Is this a bad syntax?

0 いいね!
1件の返信
Teun
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

Filtering HB database with multiple queryparams

Hi @JZielińska ,

 

Could you try one of the following solutions:

{% for row in hubdb_table_rows(module.hubdbtable_field, "services__contains=Digital&limit=2&orderBy=-date") %}

 So remove the first &, and double check if you need to capitalize 'Digital'

or:

{% set rows = hubdb_table_rows(module.hubdbtable_field) %}
{% set digital_rows = rows|selectattr('services','contains','Digital') %}

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 いいね!