<?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: Possible bug? Arcade won't work for pop-up unless fields list component is added. in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327450#M54512</link>
    <description>&lt;P&gt;Exactly what I needed. Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 20:31:08 GMT</pubDate>
    <dc:creator>hoshijun</dc:creator>
    <dc:date>2023-09-11T20:31:08Z</dc:date>
    <item>
      <title>Possible bug? Arcade won't work for pop-up unless fields list component is added.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327098#M54482</link>
      <description>&lt;P&gt;I used the following Arcade code from &lt;A href="https://community.esri.com/t5/arcgis-online-documents/conditional-field-display-with-arcade-in-pop-ups/ta-p/920869" target="_self"&gt;this forum&lt;/A&gt; to filter out empty fields. When I run it in the Arcade console, it seems to work fine. And it worked fine when I had the "Fields list" component added to the pop-up. However, when I only have the Arcade component selected, it will not display a filtered table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a bug or is this intentional? Having two field tables would be redundant.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var flds = ['Field_1','Field_2','Field_3','Field_4','Field_5'];
var info = [];
var atts = {};

for (var i in flds) {
    var fldname = flds[i];
    if (!IsEmpty($feature[fldname])) {
        Push (info, {'fieldName': fldname}) 
        atts[fldname] = $feature[fldname];
    }
}

return {
    type: 'fields',
    title: 'My Title', 
    description : 'My description',
    fieldInfos:  info,
    attributes : atts 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Sep 2023 06:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327098#M54482</guid>
      <dc:creator>hoshijun</dc:creator>
      <dc:date>2023-09-10T06:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Possible bug? Arcade won't work for pop-up unless fields list component is added.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327185#M54493</link>
      <description>&lt;P&gt;This is intentional behavior.&lt;/P&gt;&lt;P&gt;For performance reasons, Arcade only loads the fields that are needed in the expression. It does that by checking the expressions for string literals of field names ($feature.Field or $feature["Field"]).&lt;/P&gt;&lt;P&gt;That approach fails when you request fields dynamically like you do here. In this case, Arcade (actually probably the Javascript controlling the popup) just doesn't load any fields, because it doesn't realize that you need them.&lt;/P&gt;&lt;P&gt;For cases like this, Arcade has the &lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#expects" target="_blank" rel="noopener"&gt;Expects()&lt;/A&gt; function. Here you can explicitly state which fields should be available. For convenience, you can also use a wildcard.&lt;/P&gt;&lt;P&gt;Just put this at the start of your expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Expects($feature, "*")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 09:55:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327185#M54493</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-09-11T09:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Possible bug? Arcade won't work for pop-up unless fields list component is added.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327450#M54512</link>
      <description>&lt;P&gt;Exactly what I needed. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 20:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/possible-bug-arcade-won-t-work-for-pop-up-unless/m-p/1327450#M54512</guid>
      <dc:creator>hoshijun</dc:creator>
      <dc:date>2023-09-11T20:31:08Z</dc:date>
    </item>
  </channel>
</rss>

