CMS Development

hd-hs
Participant

Display results based on url and multi-select options

I have a multi-select dropdown in my HubDB table which allows users to select multiple cities for that row (see screenshot).

I want to check the url for the presence of a certain city and then display all the rows that contain that specific value in the multi-select dropdown.

 

This is currently working (see code). But instead of manually passing "london" into the condition, I want to see if the url contains any of the values from the multi select.

Can anyone help? Am very new to Hubl!

{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}
{% set path = request.path %}

{% for row in rows %}
   {% for cities in row['cities'] %}

      {% if path is containing "london" %}
         Its london!
      {% endif %}

{% endfor %}
{% endfor %}

Screenshot 2019-11-02 at 20.24.35.png
 

0 Upvotes
1 Reply 1
jackcoldrick
HubSpot Employee
HubSpot Employee

Display results based on url and multi-select options

Hi @hd-hs ,

 

If I understand you correctly you're trying to see if the path contains one of the options listed in a multiselect that is populated from your HubDB? Would you mind sending me a link to the live URL where you're currently implementing this with hard coded values?

 

Kind regards,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn