# Create a filter using two HubDB Text Columns

**URL:** <https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403>\
**Category:** CMS Development\
**Tags:** design-manager, hubdb\
**Created:** [October 29, 2020, 10:14pm UTC](https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403 "2020-10-29T22:14:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FredSan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fredsan/32/59606_2.png) [@FredSan](https://community.hubspot.com/u/FredSan)\
**Post date:** [October 29, 2020, 10:14pm UTC](https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403/1 "2020-10-29T22:14:11Z")

</div>

Hi Developers,

I am building a page displaying cards and I want them to be filtered by “title” and “description”. (both text columns in hubdb)

The search works fine when only searching by description, but as soon as I add the “title” search things just won’t work.

I have tried using this code:

```lia-code-sample
<!-- Search Input -->
<div class="search-input">
 <label for="description">Search By Title or Description</label>
 <div>
 <input name="description" type="text" id="search-by" class="autocomplete">
 </div>
</div>
<!-- Set Search Paramater -->
{% set queryparam = "" %}
 {% if request.query_dict.description != "" %}
 {% set queryparam = queryparam~"&description __icontains="~request.query_dict.title|urlencode~"&title__ icontains="~request.query_dict.title|urlencode %}
 {% endif %}

<!-- Set Table and Queryparam -->
{% set table = hubdb_table_rows(XXXXXXX, queryparam) %}

```

I have also tried creating two variables, descriptionquery and titlequery and joining the two search results with this attempt:

```lia-code-sample
<!-- Set Search Paramater -->
{% set descriptionquery = "" %}
 {% if request.query_dict.description != "" %}
 {% set descriptionquery = descriptionquery~"&description__icontains="~request.query_dict.description|urlencode %}
 {% endif %}

{% set titlequery = "" %}
 {% if request.query_dict.description != "" %}
 {% set titlequery = titlequery~"&title__icontains="~request.query_dict.title|urlencode %}
 {% endif %} 

<!-- Set Table by Query -->
{% set table = hubdb_table_rows(XXXXXXX), descriptionquery + titlequery) %}

```

Any help is greatly appreciated

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 30, 2020, 2:43pm UTC](https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403/2 "2020-10-30T14:43:38Z")

</div>

Hi @FredSan ,  
Please refer to the below solution.  
Multi-select fields, in particular, return a list, where each selection is an object containing information like the ID of the selection and the name (the text of it).  
So let’s walk through [some examples](https://prnt.sc/mul2uq). Let’s first assume that you have a multi select column named labeled ““Colors”” and whose name is ““colors””. Let’s say it has selections of ““red””, ““green””, ““blue””.

\<div class=““porfolio-services””\>  
\<div class=““website box”” id=““portfolio\_search””\>  
{% set table = hubdb\_table\_rows(111111, queryparam) %} {% if table == [] %}  
{% else %}  
{% for row in table %}  
\<div class=““categories-bx {{ row[”“type””].name }}“”\>  
\<div class=““product-img””\>  
\<img src=“”{{ row[““IMAGE””].url}}“”\>  
\</div\>  
\<div class=““categories-hover””\>  
\<h5\>{{ row.pname }}\</h5\>  
\<p\>{{ row.description }}\</p\>  
\<a href=“”{{ row.portfolio\_url }}“” class=““btn-morinfo””\>View Details\</a\>\</div\>  
\</div\>  
{% endfor %}  
{% endif %}  
\</div\>

---

<div class="post-metadata">

**Author:** ![FredSan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fredsan/32/59606_2.png) [@FredSan](https://community.hubspot.com/u/FredSan)\
**Post date:** [October 30, 2020, 9:47pm UTC](https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403/3 "2020-10-30T21:47:01Z")

</div>

Hi [@webdew](https://community.hubspot.com/t5/user/viewprofilepage/user-id/131510) ,

Thank you for explaining the multi-select option for displaying a table. The problem is that I have two “TEXT” columns in my hubdb, (Title and Description), and in my webpage I have only one search input box.

I am trying to find the query syntax to search both columns using just one search input box.

Does this make sense?

 ![33722iADA6A727EE52EBA2.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/4/452bba58df38bad8c722aabe333462d61080a821.png)

---

<div class="post-metadata">

**Author:** ![FredSan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fredsan/32/59606_2.png) [@FredSan](https://community.hubspot.com/u/FredSan)\
**Post date:** [November 3, 2020, 6:50pm UTC](https://community.hubspot.com/t/create-a-filter-using-two-hubdb-text-columns/27403/4 "2020-11-03T18:50:07Z")

</div>

I have resolved the problem by combining the Title and Description into one Rich Text column and searching the single column.
