# Using contact property as filter query in the hubdb\_table\_rows() function

**URL:** <https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971>\
**Category:** CMS Development\
**Created:** [November 24, 2022, 10:46pm UTC](https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971 "2022-11-24T22:46:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![faizwaris](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@faizwaris](https://community.hubspot.com/u/faizwaris)\
**Post date:** [November 24, 2022, 10:46pm UTC](https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971/1 "2022-11-24T22:46:34Z")

</div>

Hi,  
I have a table (id = 5461277), two columns in the table are - ‘trip\_code’ and ‘trip\_name’  
I have a contact property named ‘drdestination1’ which is equal to ‘trip\_code’ value in the table above.  
I want to dynamically display ‘trip\_name’ column value for every user with unique ‘drdestination1’ contact property. I’m not getting any value for ‘trip\_name’ as the filter query passed is not correct. What’s the right way to achieve this?  
This is the code I’m using -  
{% set abc = contact.drdestination1%}  
Contact Property is: {{abc}}  
{% for row in hubdb\_table\_rows(5461277, “trip\_code=contact.drdestination1”) %}  
{{row.trip\_name}}  
{% endfor %}

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [November 25, 2022, 10:36am UTC](https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971/2 "2022-11-25T10:36:28Z")

</div>

Hi @faizwaris ,

I think that the contact property value is not rendered when you quering your hubdb.

Can you try the following code:

```lia-code-sample
{% for row in hubdb_table_rows(5461277, "trip_code={{ contact.drdestination1|render }}") %}
 {{row.trip_name}}
{% endfor %}

```

Kind regards,

Matthieu

[matthieu.berard@markentive.com](mailto:matthieu.berard@markentive.com)

---

<div class="post-metadata">

**Author:** ![faizwaris](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@faizwaris](https://community.hubspot.com/u/faizwaris)\
**Post date:** [November 25, 2022, 12:07pm UTC](https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971/3 "2022-11-25T12:07:11Z")

</div>

it’s showing syntax error for this

---

<div class="post-metadata">

**Author:** ![KarrarJafri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@KarrarJafri](https://community.hubspot.com/u/KarrarJafri)\
**Post date:** [March 6, 2024, 7:34am UTC](https://community.hubspot.com/t/using-contact-property-as-filter-query-in-the-hubdb-table-rows-function/69971/4 "2024-03-06T07:34:58Z")

</div>

Hi,  
I’m trying to filter hubDB rows based on the HubDB row id (hs\_id) with in operator on contact property (recommended\_courses) which is coma separate text field of ids. To get multiple rows. The constant values in the IN operator work but when contact.recommended\_courses it doesn’t fetch any data from the hubDB table.  
Here’s my module code. The module is used in the marketing email.  
\<table style=“height: auto;  
font-family: Helvetica,Arial,sans-serif;  
font-weight: 800;  
justify-items: center;”\>  
\<tr style=“display: flex; gap: 12px;”\>  
{% set recommended\_courses = “158525437772,158525437487,158183984040” %}  
{% for courseCatalog in hubdb\_table\_rows(“course\_catalog”, “hs\_id\_\_in=”+(contact.recommended\_courses || “158183984040,158525437772”) |render) %}  
\<td style=“display: grid; width: 33%; grid-template-rows: 110px 116px max-content; align-items: end; justify-items: center;” \>  
\<h3 style=“font-family: Helvetica,Arial,sans-serif;  
font-weight: 800;  
align-self: start;  
justify-self: start;  
height: 100px;” \>{{ courseCatalog.course\_title }}\</h3\>  
\</td\>  
{% endfor %}  
\</tr\>  
\</table\>
