# HubDB - Filtering based on dynamic page data

**URL:** <https://community.hubspot.com/t/hubdb-filtering-based-on-dynamic-page-data/3817>\
**Category:** CMS Development\
**Created:** [November 7, 2017, 12:58pm UTC](https://community.hubspot.com/t/hubdb-filtering-based-on-dynamic-page-data/3817 "2017-11-07T12:58:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![calebkenney](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/calebkenney/32/30191_2.png) [@calebkenney](https://community.hubspot.com/u/calebkenney)\
**Post date:** [November 7, 2017, 12:58pm UTC](https://community.hubspot.com/t/hubdb-filtering-based-on-dynamic-page-data/3817/1 "2017-11-07T12:58:54Z")

</div>

Trying to create a “related products” section of a dynamic product details page, where a HubDB filter pulls other products based on the current products category column in the HubDB table.

```auto
{% for row in hubdb_table_rows(99999, "&categories__contains={{ dynamic_page_hubdb_row.attribute_8_name }}) %}
 <div class="product-listing-grid">
 <div class="product">
 <img src="{{ row.image_1.url|replace('/hubfs/' + hub_id, '/hub/' + hub_id + '/hubfs') }}?width=279" width="279"> {{ row.hs_name }}
 </div>
 </div>
{% endfor %}

```

My problem is when trying to filter the rows to display only the rows that contain the same categories as the current page/product.

How can I filter based on that dynamic content?

Or do I have to go about it in another way?

---

<div class="post-metadata">

**Author:** ![roisinkirby](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@roisinkirby](https://community.hubspot.com/u/roisinkirby)\
**Post date:** [December 20, 2017, 11:14am UTC](https://community.hubspot.com/t/hubdb-filtering-based-on-dynamic-page-data/3817/2 "2017-12-20T11:14:38Z")

</div>

@TRooInbound is this something you have seen before?

---

<div class="post-metadata">

**Author:** ![TRooInbound](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/trooinbound/32/89545_2.png) [@TRooInbound](https://community.hubspot.com/u/TRooInbound)\
**Post date:** [December 20, 2017, 3:50pm UTC](https://community.hubspot.com/t/hubdb-filtering-based-on-dynamic-page-data/3817/3 "2017-12-20T15:50:43Z")

</div>

Hi @calebkenney,

You can create query string and use that string to filter table rows.

Below is your modified code just try out and check it.

```auto
{% set CategoryParam = "&categories=" + dynamic_page_hubdb_row.attribute_8_name.id %}
{% for row in hubdb_table_rows(99999, CategoryParam) %}
 <div class="product-listing-grid">
 <div class="product">
 <img src="{{ row.image_1.url|replace('/hubfs/' + hub_id, '/hub/' + hub_id + '/hubfs') }}?width=279" width="279"> {{ row.hs_name }}
 </div>
 </div>
{% endfor %}

```

We hope it works for you.

Team TRooInbound
