<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Foreign IDs in multilevel dynamic page template populating all rows in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/662610#M29393</link>
    <description>&lt;P&gt;Apologies in advance, new to HUBL and HUBDB. So assuming I'm missing something obvious.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created a multilevel dynamic page template, and want to pull data from the level 2 database into the level 1 page. Have set up a foreign ID column in the level 1 database to select the rows I want from the level 2 database. I can pull the information that I want but I'm finding that the level 1 pages are displaying the data for all foreign ids selected in the column, not just those selected in their row. They're also ignoring the order they're selected in the foreign_id column.&lt;BR /&gt;&lt;BR /&gt;Below is an example of code giving me the result. Would greatly appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set rows = hubdb_table_rows (Table ID - for level 1) %}&lt;BR /&gt;{% for row in rows %}&lt;BR /&gt;{% for foreign_row in row.foreign_id %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ foreign_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jul 2022 04:56:27 GMT</pubDate>
    <dc:creator>NWonders</dc:creator>
    <dc:date>2022-07-11T04:56:27Z</dc:date>
    <item>
      <title>Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/662610#M29393</link>
      <description>&lt;P&gt;Apologies in advance, new to HUBL and HUBDB. So assuming I'm missing something obvious.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created a multilevel dynamic page template, and want to pull data from the level 2 database into the level 1 page. Have set up a foreign ID column in the level 1 database to select the rows I want from the level 2 database. I can pull the information that I want but I'm finding that the level 1 pages are displaying the data for all foreign ids selected in the column, not just those selected in their row. They're also ignoring the order they're selected in the foreign_id column.&lt;BR /&gt;&lt;BR /&gt;Below is an example of code giving me the result. Would greatly appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set rows = hubdb_table_rows (Table ID - for level 1) %}&lt;BR /&gt;{% for row in rows %}&lt;BR /&gt;{% for foreign_row in row.foreign_id %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ foreign_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 04:56:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/662610#M29393</guid>
      <dc:creator>NWonders</dc:creator>
      <dc:date>2022-07-11T04:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663262#M29420</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/415570"&gt;@NWonders&lt;/a&gt;! Thanks for reaching out. Let's see if our community has any insight or thoughts on how to accomplish your goal —&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/207827"&gt;@CP-BWG&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/138846"&gt;@kierana&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/16537"&gt;@dannio&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/185932"&gt;@jonflynnh2o&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/298435"&gt;@oliviadurr&lt;/a&gt;&amp;nbsp;do you have any experience or thoughts for &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/415570"&gt;@NWonders&lt;/a&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you! — Jaycee&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 23:02:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663262#M29420</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2022-07-11T23:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663316#M29421</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/415570"&gt;@NWonders&lt;/a&gt;&amp;nbsp;can you try and dump the {{ row }} in level 1 to see what comes out? Just stop at the first iteration with:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if loop.index == 1 %} {{ row }} {% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 01:40:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663316#M29421</guid>
      <dc:creator>dannio</dc:creator>
      <dc:date>2022-07-12T01:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663391#M29426</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/16537"&gt;@dannio&lt;/a&gt;&amp;nbsp;, I got the following results;&lt;BR /&gt;&lt;BR /&gt;For&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set rows = hubdb_table_rows (Table ID - for level 1) %}&lt;/P&gt;&lt;P&gt;{% for row in rows %}&lt;/P&gt;&lt;P&gt;{% if loop.index == 1 %}&lt;BR /&gt;{% for foreign_row in row.foreign_id %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ foreign_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It used the 'foreign_ID's' from 'foreign_ID column' in row 1 of 'database 1' to populate for child pages of each row in 'database 1'.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I tried the below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set rows = hubdb_table_rows (Table ID - for level 1) %}&lt;/P&gt;&lt;P&gt;{% for row in rows %}&lt;/P&gt;&lt;P&gt;{% for foreign_row in row.foreign_id %}&lt;/P&gt;&lt;P&gt;{% if loop.index == 1 %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ foreign_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It used the first 'foreign_id' from 'foreign_ID column' from each row in 'database 1' and populated them across the child pages of each row.&lt;BR /&gt;&lt;BR /&gt;Either way I can't seem to get it to only pull the 'foreign_ID's' from the&amp;nbsp;'foreign_ID column' from the row in database 1 that related to that child page.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 05:27:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663391#M29426</guid>
      <dc:creator>NWonders</dc:creator>
      <dc:date>2022-07-12T05:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663403#M29428</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/415570"&gt;@NWonders&lt;/a&gt;&amp;nbsp;which level is which in your logic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just had a quick read of &lt;A href="https://developers.hubspot.com/docs/cms/guides/dynamic-pages/hubdb/multilevel" target="_blank" rel="noopener"&gt;this&lt;/A&gt;&amp;nbsp;and it seems for multi level pages, you should be using the&amp;nbsp;&lt;STRONG&gt;hs_child_table_id&amp;nbsp;&lt;/STRONG&gt;variable to get the child table values of your row:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if dynamic_page_route_level == 0 %}
	&amp;lt;h1&amp;gt;Categories&amp;lt;/h1&amp;gt;
    {% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
    {% for row in rows %}
     	&amp;lt;h2&amp;gt;&amp;lt;a href="{{ request.path }}/{{ row.hs_path }}"&amp;gt;{{ row.hs_name }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
      	{% set childRows = hubdb_table_rows(row.hs_child_table_id) %}
      	{% for childRow in childRows %}
        	&amp;lt;li&amp;gt;&amp;lt;a href="{{ request.path }}/{{ row.hs_path }}/{{childRow.hs_path}}"&amp;gt;{{ childRow.hs_name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;   
      	{% endfor %}             
     {% endfor %}
{% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave it a try and it seems to work fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that child pages aren't generated via foreign ID columns.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Level 0 is the main page (one where you select the hubdb for the page)&lt;/P&gt;
&lt;P&gt;Level 1 is the first hubdb level&lt;/P&gt;
&lt;P&gt;Level 2 s the child table of level 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Everything in each child level are items belonging to the parent level, i.e every item in level 2 is a subpage of level 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried this on my end:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if dynamic_page_route_level == 0 %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
&amp;lt;ul&amp;gt;
  {% for row in rows %}
  {% set childRows = hubdb_table_rows(row.hs_child_table_id) %}
  {% for childRow in childRows %}
  &amp;lt;li&amp;gt;&amp;lt;a href="{{ request.path }}/{{ row.hs_path }}/{{childRow.hs_path}}"&amp;gt;{{ childRow.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;   
  {% endfor %}    
  {% endfor %}
&amp;lt;/ul&amp;gt;
{% elif dynamic_page_route_level == 1 %}
{{ dynamic_page_hubdb_row.level_1_items}}
{% elif dynamic_page_route_level == 2 %}
{{ dynamic_page_hubdb_row.level_2_items}}
{% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and everything shows up as intended. (level_1_items and level_2_items are the foreign columns I added)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or am I misunderstanding your logic?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 06:15:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663403#M29428</guid>
      <dc:creator>dannio</dc:creator>
      <dc:date>2022-07-12T06:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663428#M29430</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/16537"&gt;@dannio&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got it working. I could generate the parent and child pages just fine but was trying to pull the details of some of the child pages into their parent pages based on a foreign_id column in the parent HubDB. I was able to remove one of the loops and sets once I use the child-ids. Ended up with the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% for child_row in dynamic_page_hubdb_row.foreign_id %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ child_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 07:09:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663428#M29430</guid>
      <dc:creator>NWonders</dc:creator>
      <dc:date>2022-07-12T07:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663430#M29431</link>
      <description>&lt;P&gt;ah ok. Glad to hear it.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 07:12:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663430#M29431</guid>
      <dc:creator>dannio</dc:creator>
      <dc:date>2022-07-12T07:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663671#M29435</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/16537"&gt;@dannio&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a followup question I was hoping you might be able to help me with that relates to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have categorised the child pages in the 'child_table' using a 'Foriegn_ID' that references back to the 'parent_table_rows'. I'm wanting to pull 'Child_table' information into the 'Parent_page' based on this 'foreign_ID' in the 'child_table'. For each 'parent_page' I've looped through all rows in the 'child_table' and am then trying to limit the rows shown by this 'foreign_id'. I've tried both of the below but can't get them to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set row = hubdb_table_rows(parent_table_id) %}&lt;/P&gt;&lt;P&gt;{% set child_rows = hubdb_table_rows(child_table_id) %}&lt;/P&gt;&lt;P&gt;{% for child_row in child_rows %}&lt;/P&gt;&lt;P&gt;{% if row.name is within child_row.foreign_id|map('name') %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ child_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{% if dynamic_page_route_level == 0 %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 1 %}&lt;/P&gt;&lt;P&gt;{% set row = hubdb_table_rows(parent_table_id) %}&lt;/P&gt;&lt;P&gt;{% set child_rows = hubdb_table_rows(child_table_id, '&amp;amp;child_row.foreign_ID__contains=row.name') %}&lt;/P&gt;&lt;P&gt;{% for child_row in child_rows %}&lt;/P&gt;&lt;P&gt;&amp;lt;h6&amp;gt;&lt;BR /&gt;{{ child_row.company_name }}&lt;BR /&gt;&amp;lt;/h6&amp;gt;&lt;/P&gt;&lt;P&gt;{% endfor %}&lt;BR /&gt;{% endfor %}&lt;/P&gt;&lt;P&gt;{% elif dynamic_page_route_level == 2 %}&lt;/P&gt;&lt;P&gt;{% endif %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 13:46:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/663671#M29435</guid>
      <dc:creator>NWonders</dc:creator>
      <dc:date>2022-07-12T13:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/664163#M29457</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/415570"&gt;@NWonders&lt;/a&gt;&amp;nbsp;it seems you're missing an {% endif %} on the child_row condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you might want to try &lt;STRONG&gt;selectattr&amp;nbsp;&lt;/STRONG&gt;here. I think foreign ID columns might only be queried by ID? You'll have to experiment with it a bit for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this might work:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% for child_row in child_rows|selectattr('foreign_id', 'eq', row.hs_id) %}
  &amp;lt;h6&amp;gt;
    {{ child_row.company_name }}
  &amp;lt;/h6&amp;gt;
{% endfor %}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/cms/hubl/filters#selectattr" target="_blank"&gt;https://developers.hubspot.com/docs/cms/hubl/filters#selectattr&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best way to debug an error like this is to just constantly dump data onto the page to see what you get.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 02:23:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/664163#M29457</guid>
      <dc:creator>dannio</dc:creator>
      <dc:date>2022-07-13T02:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Foreign IDs in multilevel dynamic page template populating all rows</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/664229#M29460</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/16537"&gt;@dannio&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the values to equal one another using '|map' and then played with all the variations of '|selectattr' I could think of and couldn't get it to work. Assuming 'equalto' didn't work as it was a multiresponse column. Interestingly 'within' and 'containing' didn't work. After further experimentation, I was able to get the following to work;&lt;BR /&gt;&lt;BR /&gt;{% set child_rows = hubdb_table_rows(child_table_id) %}&lt;BR /&gt;{% for child_row in child_rows %}&lt;BR /&gt;{% set category = child_row.category|map ("hs_name") %}&lt;BR /&gt;{% set parent = dynamic_page_hubdb_row.hs_name %}&lt;BR /&gt;{% if parent is within category %}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;h6&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{{ child_row.company_name }}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/h6&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;{% endif %}&lt;BR /&gt;{% endfor %}&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 06:13:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Foreign-IDs-in-multilevel-dynamic-page-template-populating-all/m-p/664229#M29460</guid>
      <dc:creator>NWonders</dc:creator>
      <dc:date>2022-07-13T06:13:33Z</dc:date>
    </item>
  </channel>
</rss>

