<?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 expression returns value in popup in Map Viewer Classic but not Map Viewer in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244427#M49543</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;- any chance you could share the webmap? This would help us understand the issue a bit better.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Dec 2022 22:15:17 GMT</pubDate>
    <dc:creator>AnneFitz</dc:creator>
    <dc:date>2022-12-29T22:15:17Z</dc:date>
    <item>
      <title>Arcade expression returns value in popup in Map Viewer Classic but not Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1241182#M49367</link>
      <description>&lt;P&gt;In Map Viewer, I had created an expression to return a list of fields. I check whether the field has the expected prefix ('MAX') and whether its value is equal to 1. I push the field alias into an array and return the return concatenated array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var theSchema = Schema($feature);
var fields = theSchema['fields'];
var species = [];
for (var i in fields) {
   if (Find('MAX', fields[i]['name']) &amp;gt; -1 &amp;amp;&amp;amp; $feature[fields[i]['name']] == 1) {
      Push(species,fields[i]['alias']);
   }
}
return Concatenate(species,', ');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the Expression editor, this runs properly and returns the expected result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="species.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58523i6FDE10707339D48D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="species.png" alt="species.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I use this expression in the Text content&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;There are {Sum} corals species predicted or confirmed in the &lt;STRONG&gt;{ECOREGION}&lt;/STRONG&gt; ecoregion in the &lt;STRONG&gt;{PROVINCE}&lt;/STRONG&gt; province: {expression/expr0}&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;However, this expression does not display in the Map Viewer popup.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup1.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58533i561EDCBFC8D0FDA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup1.png" alt="popup1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Curiously, it does show up in Map Viewer Classic&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup_classic.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58534i63C3C7696EC4EAB6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup_classic.png" alt="popup_classic.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Why doesn't it show in Map Viewer?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 17:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1241182#M49367</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-12-14T17:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression returns value in popup in Map Viewer Classic but not Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244427#M49543</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;- any chance you could share the webmap? This would help us understand the issue a bit better.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 22:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244427#M49543</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2022-12-29T22:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression returns value in popup in Map Viewer Classic but not Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244563#M49549</link>
      <description>&lt;P&gt;Yes I could. I've also opened a ticket (&lt;SPAN&gt;#03222527)&lt;/SPAN&gt; with Esri support and we've tracked the issue down to this piece of code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;$feature[fields[i]['name']]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run this code in the editor, I get the expected result in the output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var theSchema = Schema($feature);
var fields = theSchema['fields'];
var species = [];
for (var i in fields) {
   if (Find('MAX', fields[i]['name']) &amp;gt; -1){
      Push(species,$feature[fields[i]['name']]);
   }
}
return Concatenate(species,', ');&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="withfeature.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59540iDE52C9F90D2D00EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="withfeature.png" alt="withfeature.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, the popup does not return any values in the array&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup_withfeature.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59541iC2D5E57C4876081A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup_withfeature.png" alt="popup_withfeature.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I change line 6 to&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Push(species,fields[i]['name']);&lt;/LI-CODE&gt;&lt;P&gt;then I get the expected result in both the output and the popup&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="withoutfeature.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59542iA77F12E42237F6AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="withoutfeature.png" alt="withoutfeature.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup_withoutfeature.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59543i82A233551F17588C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup_withoutfeature.png" alt="popup_withoutfeature.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 15:32:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244563#M49549</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-12-30T15:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression returns value in popup in Map Viewer Classic but not Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244959#M49582</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;- thanks for providing some more info! I think it should work if you add &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Expects($feature, 'MAX*')&lt;/FONT&gt;&lt;/STRONG&gt; at the beginning of your expression. The Expects function makes sure you have all the fields related to your expression available on the client. By default, only the fields used to visualize your data are available. For more information, check out the documentation for the&amp;nbsp;&lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#expects" target="_self"&gt;Expects function&lt;/A&gt;. Let me know if this works for you!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 17:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1244959#M49582</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2023-01-03T17:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression returns value in popup in Map Viewer Classic but not Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1245073#M49589</link>
      <description>&lt;P&gt;That was the answer. I keep forgetting about this function...plus it threw me that it worked properly in JS 3.x&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 19:13:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/m-p/1245073#M49589</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-01-03T19:13:19Z</dc:date>
    </item>
  </channel>
</rss>

