<?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 Re: Pulling data from a related tables related table (Pop-up configuration) in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140561#M44139</link>
    <description>&lt;P&gt;Pulling additional details would be just like your current expression, with the for loop being nested and repeated.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var relatedrecords = FeatureSetByRelationshipName($feature, "Provincially_Tracked_Species_Detail")

for (var f in relatedrecords){

    ... // your existing popup string stuff here

    var secondary_related = FeatureSetByRelationshipName(f, "whatever_the_other_relationship_name_is")

    for (var s in secondary_related){

        // Add more to your output string
        popupString += s.some_attribute
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you may be interested to know that you can easily create a multiline string using a backtick string, and pipe in all the attributes at the same time.&lt;/P&gt;&lt;P&gt;These lines of code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;popupString += Text(f.Com_Name) + TextFormatting.NewLine +

"Scientific Name: " +
DefaultValue(f.Sci_Name, 'no data') + TextFormatting.NewLine +

"Taxon: " +
DefaultValue(f.Lower_Taxon, 'no data') + TextFormatting.NewLine +

"SARO Status: " +
DefaultValue(f.SARO_Status, 'no data') + TextFormatting.NewLine +
TextFormatting.NewLine&lt;/LI-CODE&gt;&lt;P&gt;Are equivalent to these:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;popupString += `${Text(f.Com_Name)}
Scientific Name: ${DefaultValue(f.Sci_Name, 'no data')}
Taxon: ${DefaultValue(f.Lower_Taxon, 'no data')}
SARO Status: ${DefaultValue(f.SARO_Status, 'no data')}

`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 21:17:49 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-02-03T21:17:49Z</dc:date>
    <item>
      <title>Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140548#M44136</link>
      <description>&lt;P&gt;I'm currently trying to create a pop-up which pulls data from related tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been successful in puling data from the table immediately related to the feature layer. But there is a table related to that related table that I also want to pull data from. The feature layer is a polygon, the related table has species that occur within that polygon and the secondary related table is supplemental information about that species.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feature Layer &amp;lt;&amp;gt; Related Table &amp;lt;&amp;gt; Related Table&lt;/P&gt;&lt;P&gt;This is my current expression for my feature layer:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedrecords = FeatureSetByRelationshipName($feature,"Provincially_Tracked_Species_Detail");
var popupString = ""
for (var f in relatedrecords){
popupString += Text(f.Com_Name) + TextFormatting.NewLine +

"Scientific Name: " +
DefaultValue(f.Sci_Name, 'no data') + TextFormatting.NewLine +

"Taxon: " +
DefaultValue(f.Lower_Taxon, 'no data') + TextFormatting.NewLine +

"SARO Status: " +
DefaultValue(f.SARO_Status, 'no data') + TextFormatting.NewLine +
TextFormatting.NewLine
}
return popupString&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are my results:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pop-up Results.JPG" style="width: 321px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33078i2FF16C601CFA5C37/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results.JPG" alt="Pop-up Results.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have also made an expression for my first related table pulling data from the second related table but because it is an expression not a real field it won't let me use it like any of the other fields (as I did with other fields in the above example).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully, this makes sense. If you have any suggestions on a solution, please let me know.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:18:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140548#M44136</guid>
      <dc:creator>cpenling</dc:creator>
      <dc:date>2022-02-03T21:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140561#M44139</link>
      <description>&lt;P&gt;Pulling additional details would be just like your current expression, with the for loop being nested and repeated.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var relatedrecords = FeatureSetByRelationshipName($feature, "Provincially_Tracked_Species_Detail")

for (var f in relatedrecords){

    ... // your existing popup string stuff here

    var secondary_related = FeatureSetByRelationshipName(f, "whatever_the_other_relationship_name_is")

    for (var s in secondary_related){

        // Add more to your output string
        popupString += s.some_attribute
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you may be interested to know that you can easily create a multiline string using a backtick string, and pipe in all the attributes at the same time.&lt;/P&gt;&lt;P&gt;These lines of code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;popupString += Text(f.Com_Name) + TextFormatting.NewLine +

"Scientific Name: " +
DefaultValue(f.Sci_Name, 'no data') + TextFormatting.NewLine +

"Taxon: " +
DefaultValue(f.Lower_Taxon, 'no data') + TextFormatting.NewLine +

"SARO Status: " +
DefaultValue(f.SARO_Status, 'no data') + TextFormatting.NewLine +
TextFormatting.NewLine&lt;/LI-CODE&gt;&lt;P&gt;Are equivalent to these:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;popupString += `${Text(f.Com_Name)}
Scientific Name: ${DefaultValue(f.Sci_Name, 'no data')}
Taxon: ${DefaultValue(f.Lower_Taxon, 'no data')}
SARO Status: ${DefaultValue(f.SARO_Status, 'no data')}

`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140561#M44139</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-03T21:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140569#M44142</link>
      <description>&lt;P&gt;It worked! Thanks so much for your help and additionally your advice to simplify my code. Also, generally speaking thanks for your contribution and help on this forum. It's greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:37:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140569#M44142</guid>
      <dc:creator>cpenling</dc:creator>
      <dc:date>2022-02-03T21:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140580#M44143</link>
      <description>&lt;P&gt;For some reason the code works in the test but nothing shows in the pop-up. When I comment out the new section to that secondary related table, the information shows up fine. Do you know why this would be happening?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Expression with secondary related table section" style="width: 732px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33084i4A16E92E52AF18CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results 2.JPG" alt="Expression with secondary related table section" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Expression with secondary related table section&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pop-up with secondary related table section" style="width: 326px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33085iD1FC5F76B750FB3E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results 3.JPG" alt="Pop-up with secondary related table section" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pop-up with secondary related table section&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Expression without secondary related table section" style="width: 729px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33086iFB62035434AC34A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results 4.JPG" alt="Expression without secondary related table section" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Expression without secondary related table section&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pop-up without secondary related table section" style="width: 324px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33087i633A0752D72C4D0B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results 5.JPG" alt="Pop-up without secondary related table section" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pop-up without secondary related table section&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140580#M44143</guid>
      <dc:creator>cpenling</dc:creator>
      <dc:date>2022-02-03T21:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140587#M44148</link>
      <description>&lt;P&gt;Curious. I've seen this sort of thing happen before. I wonder if it has to do with a null value somewhere. Can you find out what UTM Zone the test is running against and check the popup of that feature?&lt;/P&gt;&lt;P&gt;Also, can you try to replace the "for (var s in secondary_related)" section with something else? Maybe just add Count(secondary_related) to the output string to make sure that it's finding something? Sometimes a for loop errors out when there's nothing in the featureset.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 22:11:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140587#M44148</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-03T22:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling data from a related tables related table (Pop-up configuration)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140752#M44157</link>
      <description>&lt;P&gt;Thanks again! It was due to my id field (Sci_Name) having null values. I had to keep those null values so I ended up putting in an if statement and that solved the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pop-up Results 6.JPG" style="width: 629px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33147iF8D1770EA066945D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pop-up Results 6.JPG" alt="Pop-up Results 6.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 13:51:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pulling-data-from-a-related-tables-related-table/m-p/1140752#M44157</guid>
      <dc:creator>cpenling</dc:creator>
      <dc:date>2022-02-04T13:51:06Z</dc:date>
    </item>
  </channel>
</rss>

