Query Syntax HUBDB

SOLVE
imerial
Participant

Hi Community,

 

I'm trying to filter a table I have using contain.  The AssetClass column is TEXT. I want to display only rows that have the word Future-Index and Commodity. example1.png

I wrote the following but It doesn't work. I don't know how to use two different parameters for contains.  Can anyone help me figure out? Thank you

 

{% set table = hubdb_table_rows(2595031,'assetclass__contains=Future-index,Commodity') %}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}
<div class="card tblHolding" id="Holding">
<div class="card-body">
<!-- <h1>{{ module.heading }}<span>{{ module.sub_heading }}</span></h1> -->
<div class="card-text">
<div>
<div class="row">
<div class="custom-column">
<table class="table table-striped">
<thead>
<tr>
<th><span>Stockticker </span></th>
<th><span>Security Name</span></th>
<th><span>Shares </span></th>
<th><span>Price </span></th>
<th><span>Market Value</span></th>
<th><span>Weightings</span></th>
<th><span>Asset Class</span></th>

</tr>
</thead>
<tbody>

{% for item in table %}
<tr>
<td>{{ item.stockticker }}</td>
<td>{{ item.securityname }}</td>
<td>{{ item.shares }}</td>
<td>{{ item.price }}</td>
<td>{{ item.marketvalue }}</td>
<td>{{ item.weightings }}</td>
<td>{{ item.assetclass }}</td>
</tr>
{% endfor %}
</tbody>
</table> 
</div>
</div>
<div class="row bottom">
<div class="bottom-content"><h5>{{ module.bottom_text }}</h5></div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
0 Upvotes
1 Accepted solution

Accepted Solutions
amwilie
Solution
Key Advisor | Elite Partner

Hey @imerial ,

 

As far as I know you can't use multiple parameters with contain. You could either create two separate table listings for each assetclass you want to list OR switch these columns to a SELECT option and use the in filter name.

 

{% set table = hubdb_table_rows(2595031,'assetclass__in=Future - Index,Commodity') %}

 

border

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post

1 Reply 1
amwilie
Solution
Key Advisor | Elite Partner

Hey @imerial ,

 

As far as I know you can't use multiple parameters with contain. You could either create two separate table listings for each assetclass you want to list OR switch these columns to a SELECT option and use the in filter name.

 

{% set table = hubdb_table_rows(2595031,'assetclass__in=Future - Index,Commodity') %}

 

border

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post