CMS Development

ben-duchy
Top Contributor

HubL filter if statement

Hi everyone,

 

I really hope someone can help me. I've recently setup a filter that displays my data if the status column is 'Available'. It works as expected, but I'm now trying to add a second rule - show the data if it is either 'Available' or 'Reserved', ignoring 'Sold' and 'Unavailable'.

 

I assumed it would require an If statement, but as yet I can't get it working. Any idea what I'm doing wrong?

 

hubdb-filter.jpg

0 Upvotes
2 Replies 2
prasadcolumbus
Participant | Diamond Partner
Participant | Diamond Partner

HubL filter if statement

Try this below code and request.query_dict.topic  is get the data from URL

{% if request.query_dict.topic %}
{% set queryparam = queryparam ~ "&media_type="~request.query_dict.topic|urlencode %}
{% endif %}
{% set count = hubdb_table_rows(tableId, queryparam) %}

0 Upvotes
ben-duchy
Top Contributor

HubL filter if statement

Hi @prasadcolumbus,

 

Pardon my ignorance, I might be missing something here, but isn't this used for when the user makes a selection, changing the filter on a live page?

 

I'm not giving the user access to the feature (yet), but instead it needs to be hard coded to only ever show if the status is either available or reserved. Is this possible?

0 Upvotes