<?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: Arcade Filter/Relate not working in Popup in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276812#M13591</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are you linking the script to the popup? Do you have it checked in the Configure Attributes dialog?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Oct 2020 22:53:46 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2020-10-21T22:53:46Z</dc:date>
    <item>
      <title>Arcade Filter/Relate not working in Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276811#M13590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Popup only shows the expression label and then no value even though the arcade expression works in the test expression window.&amp;nbsp; I followed the blog about using featuresets to create a relate and add it to a popup - &lt;A href="https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2020/06/09/show-related-data-or-tables-in-pop-ups-with-arcade-featuresets"&gt;https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2020/06/09/show-related-data-or-tables-in-pop-ups-with-arcade-featuresets&lt;/A&gt;&amp;nbsp;-&amp;nbsp;&lt;A href="https://community.esri.com/migration-blogpost/11652"&gt;Gee Fernando's Blog&lt;/A&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Here is my code:&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;// Write a script to return a value to show in the pop-up.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;var portal = Portal("&lt;/SPAN&gt;&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices.wygisc.org%2Fportal" rel="nofollow" style="color: #287433; border: 0px; font-weight: inherit; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;https://services.wygisc.org/portal&lt;/A&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;")&lt;/SPAN&gt;&lt;BR /&gt;var speciesRelate = FeatureSetByPortalItem(portal,&lt;BR /&gt;"6a0c8bcd1d164d99b76f162f140212f8", 0, ['Species', 'Taxa',&lt;BR /&gt;'Occurrence_Potential', 'BLM_Status',&lt;BR /&gt;'Texas_________________Status', 'Federal_Status', 'Habitat',&lt;BR /&gt;'Code'])&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;// Filter related features by using a common attribute&lt;BR /&gt;var HabCode = $feature.HabCode&lt;BR /&gt;var codeStatement = 'Code = @HabCode'&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;//Related features as a variable&lt;BR /&gt;var relateData = Filter(speciesRelate, codeStatement)&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;//build popupString by iterating through all related features&lt;BR /&gt;var popupString = ''&lt;BR /&gt;for (var f in relateData){&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;popupString += "Species: " + Text(f.Species) + TextFormatting.NewLine +&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;"Taxa: " + f.Taxa + TextFormatting.NewLine +&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;"Occurrence Potential: " + f.Occurrence_Potential + TextFormatting.NewLine +&lt;BR /&gt;TextFormatting.NewLine&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" height="304" src="https://community.esri.com/legacyfs/online/511514_ArcadeTestExpression.PNG" style="border: 0px; font-weight: inherit; margin: 2px 0px 0px;" width="752" /&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" height="237" src="https://community.esri.com/legacyfs/online/511515_PopUpExpressionEmpty.PNG" style="border: 0px; font-weight: inherit; margin: 2px 0px 0px;" width="398" /&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Thoughts?&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Thanks,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Shawn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2020 21:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276811#M13590</guid>
      <dc:creator>ShawnLanning</dc:creator>
      <dc:date>2020-10-21T21:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter/Relate not working in Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276812#M13591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are you linking the script to the popup? Do you have it checked in the Configure Attributes dialog?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2020 22:53:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276812#M13591</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-10-21T22:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter/Relate not working in Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276813#M13592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes - I believe I have the pop-up configured correctly and even created a very simple arcade expression that does work, though I could be missing something?&amp;nbsp; See below:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/511568_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2020 14:34:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276813#M13592</guid>
      <dc:creator>ShawnLanning</dc:creator>
      <dc:date>2020-10-22T14:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter/Relate not working in Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276814#M13593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/sgl55" target="_blank"&gt;sgl55&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if you did not include the complete expression, but at the end you should return the "popupString". That is the main reason you are not getting any result.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// Write a script to return a value to show in the pop-up.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; portal &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Portal&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"https://services.wygisc.org/portal"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; speciesRelate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portal&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;"6a0c8bcd1d164d99b76f162f140212f8"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Species'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Taxa'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'Occurrence_Potential'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'BLM_Status'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'Texas_________________Status'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Federal_Status'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Habitat'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'Code'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Filter related features by using a common attribute&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; HabCode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;HabCode&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; codeStatement &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Code = @HabCode'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;//Related features as a variable&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; relateData &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Filter&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;speciesRelate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; codeStatement&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;//build popupString by iterating through all related features&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popupString &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; relateData&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    popupString &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Species: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Species&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; 
                   TextFormatting&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewLine &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;
                   &lt;SPAN class="string token"&gt;"Taxa: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Taxa &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TextFormatting&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewLine &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;
                   &lt;SPAN class="string token"&gt;"Occurrence Potential: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Occurrence_Potential"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; 
                   TextFormatting&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewLine &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TextFormatting&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewLine&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; popupString&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also recommend to access fields that contain an underscore using feature["Field_Name"] and nor as feature.Field_Name (see line 22).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid on lines 4 to 6 to include fields that you are not using to increment performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-relate-not-working-in-popup/m-p/276814#M13593</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T13:29:03Z</dc:date>
    </item>
  </channel>
</rss>

