- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Hubl & HubDB Filtering Column Values
SOLVEJan 28, 2020 9:59 AM
Hello! First, thank you for your time. I am working with a database full of classes (like school work) and I'm trying to display a certain type of class that has been categorized. Each row in my database is basically a class. There are a number of columns, but specifically; I have set 3 categories and I would like to display all the classes in the category "Practice Advancement."
I have followed this tutorial (https://app.hubspot.com/academy/5297945/tracks/34/354/1922) and was successful in accomplishing the task to this effect:
https://connect.woodard.com/2020-all-snh-sessions -- (horay!)
However, you can tell the list is crazy-long. So, long-story-long, I tried to filter out the classes by adding a filter to the loop:
{% for row in hubdb_table_rows(2033946) %}
The above works (I promise). The below does not:
{% for row in hubdb_table_rows(2033946, 'session_category__contains=Practice Advancement') %}
By swapping out the line above, I break the loop and the page will not display much at all. Can anyone help me with the filter I applied, I used the documentation and noticed I could use "__contains" or "__eq" . . . neither work. "Practice Advancement" might be the issue, but I don't know why as I'm following the direction from the video.
Thank you again for any insight / help with this!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Jan 29, 2020 9:24 AM
Try swapping
?session_category=Practice Advancement
to
?session_category=1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Jan 29, 2020 10:37 AM
Good news Bryan!
Ok, going back to the documentation didn't help. You were very close actually. I went back and removed the loop surrounding the for-loop. And in doing so I also (purposefully) threw an error in. The text editor found the error and displayed it. So I went through and troubleshot with the error and eventually came to this conclusion:
{% for row in hubdb_table_rows(2033946, 'session_category=1') %}
Which does not work with the "?" or any of the filters supplied in documentations (operators). So, you and I fixed this, but there are problems with HubL in my opinon.
Thank you so much Bryan! I'm going to mark your comment as solution as it did lead to my fix.
Page with the filter working:
https://connect.woodard.com/2020-all-snh-practice-avancement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content