# Error in my HubL code; please help!

**URL:** <https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123>\
**Category:** Tips, Tricks & Best Practices\
**Tags:** professional\
**Created:** [December 7, 2021, 1:31pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123 "2021-12-07T13:31:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wmflan39](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wmflan39/32/45434_2.png) [@wmflan39](https://community.hubspot.com/u/wmflan39)\
**Post date:** [December 7, 2021, 1:31pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123/1 "2021-12-07T13:31:05Z")

</div>

On our one of our staging pages (\*link removed due to security reasons)

I use accordions to present product listings from our ‘lenses’ HubDB ID 5307563. All column 1 and most of column 2 accordions work as expected, sample code per:

```lia-code-sample
<div>{% set table_id = 5307563%}</div>
<div>{% for row in hubdb_table_rows(5307563,'class__contains=Pinhole') %} <img src="https://f.hubspotusercontent40.net/hubfs/20881091/images/{{ row.filename }}.jpg" data-constrained="true" style="float: right; display: inline-block; width: 200px; padding-top: 20px;">
<p>Model: {{ row.model_no }}<br>MTF: <a href="https://f.hubspotusercontent40.net/hubfs/20881091/pdfs/mtf-{{ row.filename }}.pdf" rel="noopener">{{ row.filename }}</a><br>Focal Length (mm): {{ row.focal_length }}<br>Aperature (f): {{ row.aperature }}<br>Back Focal Length (mm): {{ row.back_focal }}<br>Sensor: {{row.sensor }}<br>Field of View (deg): {{ row.field_of_view }}</p>
<div>Request: <a href="/data-sheet-request?interest=lenses&document_filename=pds-{{ row.filename }}.pdf&document_title={{ row.name }}&part_number={{ row.name }}">{{ row.name }}</a></div>
<hr>{% endfor %}</div>

```

where rows are selected by ‘class’. The last 2 accordion sections in column 2 (CS - 3MP & M14 - VF) cheerfully refuse to display the required content. Sample code:

```lia-code-sample
<div>{% set table_id = 5307563%}</div>
<div>{% for row in hubdb_table_rows(5307563,'class__contains=CS - 3MP') %} <img src="https://f.hubspotusercontent40.net/hubfs/20881091/images/{{ row.filename }}.jpg" data-constrained="true" style="float: right; display: inline-block; width: 200px; padding-top: 20px;">
<p>Model: {{ row.model_no }}<br>MTF: <a href="https://f.hubspotusercontent40.net/hubfs/20881091/pdfs/mtf-{{ row.filename }}.pdf" rel="noopener">{{ row.filename }}</a><br>Focal Length (mm): {{ row.focal_length }}<br>Aperature (f): {{ row.aperature }}<br>Back Focal Length (mm): {{ row.back_focal }}<br>Sensor: {{row.sensor }}<br>Field of View (deg): {{ row.field_of_view }}</p>
<div>Request: <a href="/data-sheet-request?interest={{ row.product }}&document_filename=pds-{{ row.filename }}.pdf&document_title={{ row.name }}&part_number={{ row.name }}">{{ row.name }}</a></div>
<hr>{% endfor %}</div>

```

Rows with classes ‘CS - 3MP’ and ‘M14 - VF’ exist in the HubDB, yet these refuse to display. I have taken several steps to trouble-shoot but nothing works.

Is there anything obvious in what I’m doing wrong?

WmFlanigan

---

<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:** [December 7, 2021, 10:02pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123/2 "2021-12-07T22:02:55Z")

</div>

Hello @wmflan39 I would like to add some top experts to this matter to share their ideas, @psdtohubspot @stefen any recommendations to @wmflan39 matter?

Thank you,

Pam

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [December 9, 2021, 2:21pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123/3 "2021-12-09T14:21:32Z")

</div>

@wmflan39 it’s kind of hard to understand what’s going on here. Are you able to make a reduced test case? And possibly the structure/schema of the hubdb table?

---

<div class="post-metadata">

**Author:** ![wmflan39](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wmflan39/32/45434_2.png) [@wmflan39](https://community.hubspot.com/u/wmflan39)\
**Post date:** [December 9, 2021, 2:37pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123/4 "2021-12-09T14:37:12Z")

</div>

Stefan, thanks for replying.

I have tried to isolate the problem by moving code from one of the working accordions into the offending accordion: success.

Then editing the ‘class’ filter in the code transplanted to the offending accordion to display the product class ‘M12 - 10MP’ from

`{% for row in hubdb_table_rows(5307563,'class__contains=M12 - 10MP') %}`

to

`{% for row in hubdb_table_rows(5307563,'class__contains=CS - 3MP') %}`

…trying to display the product class ‘CS - 3MP’. Result: fail. Must be something with the DB. I’ve deleted the row for the offending single record for CS - 3MP and re-entered the data manually: fail.

I’m not sure what you mean by the schema of the table. The class column is a multi-select contining ~20 entries. All other columns are text fields.

How can I better answer your question?

WmF

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [December 9, 2021, 3:40pm UTC](https://community.hubspot.com/t/error-in-my-hubl-code-please-help/48123/5 "2021-12-09T15:40:43Z")

</div>

@wmflan39 you might want to try url escaping the spaces e.g.:

`{% for row in hubdb_table_rows(5307563,'class__contains=CS%20-%203MP') %}`

Another thing to note is that the contains filter when used with a multiselect column returns rows that contain all of the supplied values.
