<?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: Add related field to ArcGIS Online Popup using Arcade in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061331#M5879</link>
    <description>&lt;P&gt;What exactly is not working? Do you get error messages?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var planrecs = FeatureSetByName($map,"House_Number_Change - Address Form and Plan Recs")
var FullAddress = $feature.FullAddress

// var filterStatement = 'OIDStr = @OIDstr'
// this won't work, as you haven't declared the variable "OIDstr". The @ syntax takes care of the proper formatting depending on the type of OIDstr (integer, string, etc), but you have to define what OIDstr actually is:
// also, check the spelling: OIDStr vs. OIDstr
var OIDstr = $feature.OIDstr
var filterStatement = 'OIDStr = @OIDstr'

// Related features as a variable
var relatedData = Filter(planrecs, filterStatement)

// Just exit here if there are no related features
if(Count(relatedFeatures) == 0) {
  return 'No other records to show'
}

// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedData){
//  popupString += Text(f.AIN, 'no data') + TextFormatting.NewLine + "Path: " + DefaultValue(f.Path, 'no data') + TextFormatting.NewLine
// You're using wrong arguments for Text. I think you want to use DefaultValue?
  popupString += DefaultValue(f.AIN, 'no data') + TextFormatting.NewLine + "Path: " + DefaultValue(f.Path, 'no data') + TextFormatting.NewLine
}
return popupString&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 13:39:12 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2021-05-25T13:39:12Z</dc:date>
    <item>
      <title>Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061269#M5878</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;I want to relate a table hosted on a private ArcGIS Server to a feature layer hosted on the same server using a field called "OIDStr" in the table and a field caled "OIDstr" in the feature layer. I then want to show a hyperlink field in that related table in the popup I configured for the feature layer. What I have so far which I found at this &lt;A href="https://community.esri.com/t5/arcgis-online-blog/show-related-data-or-tables-in-pop-ups-with-arcade-featuresets/ba-p/890530" target="_self"&gt;link&lt;/A&gt; is not working. Are there any suggestions that could help me? I also may need to incorporate an if statement found &lt;A href="https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196403" target="_self"&gt;here&lt;/A&gt; to prevent getting errors when there is no related data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var planrecs = FeatureSetByName($map,"House_Number_Change - Address Form and Plan Recs");&lt;BR /&gt;var FullAddress = $feature.FullAddress&lt;BR /&gt;var filterStatement = 'OIDStr = @OIDstr'&lt;/P&gt;&lt;P&gt;// Related features as a variable&lt;BR /&gt;var relatedData = Filter(planrecs, filterStatement)&lt;/P&gt;&lt;P&gt;// Build the pop-up string by iterating through all related features&lt;BR /&gt;var popupString = ''&lt;BR /&gt;for (var f in relatedData){&lt;BR /&gt;&lt;BR /&gt;popupString += Text(f.AIN, 'no data') + TextFormatting.NewLine +&lt;BR /&gt;&lt;BR /&gt;"Path: " +&lt;BR /&gt;DefaultValue(f.Path, 'no data') + TextFormatting.NewLine&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;DefaultValue(popupString, 'No other records to show')&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 09:06:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061269#M5878</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-25T09:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061331#M5879</link>
      <description>&lt;P&gt;What exactly is not working? Do you get error messages?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var planrecs = FeatureSetByName($map,"House_Number_Change - Address Form and Plan Recs")
var FullAddress = $feature.FullAddress

// var filterStatement = 'OIDStr = @OIDstr'
// this won't work, as you haven't declared the variable "OIDstr". The @ syntax takes care of the proper formatting depending on the type of OIDstr (integer, string, etc), but you have to define what OIDstr actually is:
// also, check the spelling: OIDStr vs. OIDstr
var OIDstr = $feature.OIDstr
var filterStatement = 'OIDStr = @OIDstr'

// Related features as a variable
var relatedData = Filter(planrecs, filterStatement)

// Just exit here if there are no related features
if(Count(relatedFeatures) == 0) {
  return 'No other records to show'
}

// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedData){
//  popupString += Text(f.AIN, 'no data') + TextFormatting.NewLine + "Path: " + DefaultValue(f.Path, 'no data') + TextFormatting.NewLine
// You're using wrong arguments for Text. I think you want to use DefaultValue?
  popupString += DefaultValue(f.AIN, 'no data') + TextFormatting.NewLine + "Path: " + DefaultValue(f.Path, 'no data') + TextFormatting.NewLine
}
return popupString&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 13:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061331#M5879</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-05-25T13:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061571#M5880</link>
      <description>&lt;P&gt;Hi Johannes:&lt;BR /&gt;&lt;BR /&gt;I appreciate your help and for the script. I assume if(Count(relatedFeatures)) was supposed to be if(Count(relatedData)) correct? I am getting the same error message which was&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrandonPrice2_0-1621975863899.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/14149iCFE5FD98FCB5C689/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BrandonPrice2_0-1621975863899.png" alt="BrandonPrice2_0-1621975863899.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think it still has to do with the issue at this &lt;A href="https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196403" target="_blank"&gt;link&lt;/A&gt; because the error message I am getting is the same.&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 20:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061571#M5880</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-25T20:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061596#M5881</link>
      <description>&lt;P&gt;The code works when I add it to the table although not the layer. This is because the relationship is one to many I think. Many related records per feature.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrandonPrice2_0-1621979733073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/14158iFC6193BCD9C80320/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BrandonPrice2_0-1621979733073.png" alt="BrandonPrice2_0-1621979733073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 21:55:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1061596#M5881</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-25T21:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1062219#M5886</link>
      <description>&lt;P&gt;Hi Johannes:&lt;/P&gt;&lt;P&gt;I was able to get it to work utilizing the code&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;provided at this link:&amp;nbsp;&lt;A href="https://community.esri.com/t5/developers-questions/get-1-m-related-objects-using-arcade/td-p/736778" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/developers-questions/get-1-m-related-objects-using-arcade/td-p/736778&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The related field I want to display multiple related records for in the popup are hyperlinks. They show as text using the solution I used so I tweaked it to only show one hyperlink rather than all. How can I adjust it so are related hyperlinks are shown?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 19:48:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1062219#M5886</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-06-18T19:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1062841#M5890</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I hate to be the carrier of bad news, but in ArcGIS Online at this moment you cannot return HTML and you will need HTML to create multiple links from a single Arcade expression (ArcGIS Pro supports this, but AGOL is not there yet). There are ways to accomplish this in AGOL (in theory) but these would need multiple expressions and conditional visualization and would have a serious impact on performance.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 13:30:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1062841#M5890</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-28T13:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add related field to ArcGIS Online Popup using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1069974#M5917</link>
      <description>&lt;P&gt;I will work around this and return the first related hyperlink in the loop in the first expression and the second related hyperlink in the second expression.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 19:49:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-related-field-to-arcgis-online-popup-using/m-p/1069974#M5917</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-06-18T19:49:52Z</dc:date>
    </item>
  </channel>
</rss>

