# hubDB help. orderBy and show certain rows

**URL:** <https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261>\
**Category:** CMS Development\
**Tags:** professional, starter\
**Created:** [February 28, 2024, 12:45am UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261 "2024-02-28T00:45:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RHenderson2](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@RHenderson2](https://community.hubspot.com/u/RHenderson2)\
**Post date:** [February 28, 2024, 12:45am UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/1 "2024-02-28T00:45:08Z")

</div>

I have a listing page which pulls data from a hubDB table.

I want to sort alphabetically (orderBy=part\_number) and only show rows with a column selected as Board Level (standard\_product\_type=Board Level).

this code works:  
{% for row in hubdb\_table\_rows(5297230, “orderBy=part\_number”) %}

and this code works:  
{% for row in hubdb\_table\_rows(5297230, " standard\_product\_type=Board Level") %}

But, when put together, only the first option works and the second doesn’t.  
{% for row in hubdb\_table\_rows(5297230, “standard\_product\_type=Board Level”, “orderBy=part\_number”) %}

How do i get both options to work in my application?

thanks in advance!

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [February 28, 2024, 10:40am UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/2 "2024-02-28T10:40:26Z")

</div>

Hi @RHenderson2

I would suggest using the AND operator to combine your both conditions like this “standard\_product\_type=Board Level&orderBy=part\_number”.

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!

---

<div class="post-metadata">

**Author:** ![PamCotton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pamcotton/32/47916_2.png) [@PamCotton](https://community.hubspot.com/u/PamCotton)\
**Post date:** [February 29, 2024, 2:50pm UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/3 "2024-02-29T14:50:23Z")

</div>

HI @RHenderson2 is there a specific template you are currently using?

Have you tried adding in your code? This ensures that the code remains intact without breaking. The more information, screenshots, and details you can provide, the better I can advise on the next steps.

Thank you,

Pam

---

<div class="post-metadata">

**Author:** ![RHenderson2](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@RHenderson2](https://community.hubspot.com/u/RHenderson2)\
**Post date:** [March 4, 2024, 8:42pm UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/4 "2024-03-04T20:42:04Z")

</div>

Hi Gaurav,

For my initial question, your awnser is the solution. adding the & operator works great.

In my case, this lead me to another topic of how I can succesfully add the code into a custom module via Design Tools. Currently HubSpot will not parse correctly via the rich text box via a webpage. thank you again!

---

<div class="post-metadata">

**Author:** ![RHenderson2](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@RHenderson2](https://community.hubspot.com/u/RHenderson2)\
**Post date:** [February 29, 2024, 1:18am UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/5 "2024-02-29T01:18:04Z")

</div>

Hi Gaurav,

Thank you for your response.

The HubSpot module is changing & to & which is very frustrating. I also tried a rich text block module in advanced source code view. Same thing. & turns into & causing code to break.

Have you ever come across this as well?

---

<div class="post-metadata">

**Author:** ![RHenderson2](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@RHenderson2](https://community.hubspot.com/u/RHenderson2)\
**Post date:** [February 29, 2024, 7:11pm UTC](https://community.hubspot.com/t/hubdb-help-orderby-and-show-certain-rows/101261/6 "2024-02-29T19:11:08Z")

</div>

Hi Pam,

Thank you for your help.

yes, I will add a screenshot of what is happening.

I enter the code bu using the advanced \> source code.

 ![hubspot-how-i-enter-code.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/4/6433560aba36eabca90de139242a41a63fb37a17.png)

The next image is the code editor view. Line 6 is the code in question (highlighted red, &orderBy). After I save the module and look at it again, HubSpot changes the code to the second screen shot. (&orderBy). I haven’t found away around this. Any ideas would be most helpful.

 ![hubspot-code-entered.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/9/09dc6e5e9446e412966607c8c421e72dc9a997dc.png)  
code entered

Upon save, here is the code which has magiclly been changed to the&.

 ![hubspot-code-change.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/d/ad814abdb6dfb87138d3567aa5aeb6441bb32182.png)  
HubSpot auto change
