<?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: Help with a Arcade Popup expression in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259818#M50468</link>
    <description>&lt;P&gt;That worked!! Thanks for the help.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2023 13:17:47 GMT</pubDate>
    <dc:creator>RandyMcGraw1</dc:creator>
    <dc:date>2023-02-20T13:17:47Z</dc:date>
    <item>
      <title>Help with a Arcade Popup expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259351#M50441</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have point building data that contains multiple entries for the same facility (points on top of points in the same Feature Layer). The points are created each fiscal year.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am trying to use Arcade to get the most current Fiscal Year data and populate any popup with the same facility ID.&lt;/P&gt;&lt;P&gt;Here is the code I have come up with:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//Access portal and Get Feature
var portal = Portal("https://*******************.maps.arcgis.com/")
var fac = FeatureSetByPortalItem (portal,"***************************", 0, ['*'],false)

//Filter features by 'FacilityID' when clicking on a feature
var this = $feature.FacilityID
var filterStatement = 'FacilityID =@this'
var allElement = Filter(fac, filterStatement)

//Select most current data
var popupString=''
if (allElement.FiscalYear =='2021-2022'){
   popupString += allElement.TotalGHG
} 

//format text
var popupStringB = Text (popupString, '###,###.0')

//populate popup
DefaultValue(popupStringB, 'no data')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be appreciated.&lt;/P&gt;&lt;P&gt;Randy&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 15:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259351#M50441</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2023-02-17T15:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Arcade Popup expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259388#M50443</link>
      <description>&lt;P&gt;&amp;nbsp;Since there appears to be only one point per fiscal year, why not add that into your filter? Then you should be able to get the single point.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var filterStatement = "FacilityID = @this AND FiscalYear == '2021-2022'"&lt;/LI-CODE&gt;&lt;P&gt;Next, the &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter" target="_self"&gt;Filter&lt;/A&gt; function returns a FeatureSet, so you'll have to get at the data differently. Since you should only have one record here, you can use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#first" target="_self"&gt;First&lt;/A&gt; function to get that record.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var allElement = Filter(fac, filterStatement);
var myFeature = First(allElement);
var PopupStringB = Text(myFeature.TotalGHG, '###,###.0')
DefaultValue(popupStringB, 'no data') &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 16:33:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259388#M50443</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-02-17T16:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Arcade Popup expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259547#M50454</link>
      <description>&lt;P&gt;Hello KenBuja,&lt;/P&gt;&lt;P&gt;Thank you for taking the time.&lt;BR /&gt;&lt;BR /&gt;I tried your suggestion but get the following result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGraw1_0-1676666546001.png" style="width: 574px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/63161i2CF1D1A5CA379684/image-dimensions/574x66?v=v2" width="574" height="66" role="button" title="RandyMcGraw1_0-1676666546001.png" alt="RandyMcGraw1_0-1676666546001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I used:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//Access portal and Get Feature
var portal = Portal("https://**************.maps.arcgis.com/")
var fac = FeatureSetByPortalItem (portal,"cbf4d4cf514a44b91493d0cb7bb569", 0, ['*'],false)

//Filter features by 'FacilityID' when clicking on a feature
var this = $feature.FacilityID;
var filterStatement = "FacilityID =@this AND FiscalYear =='2021-2022'";
var allElement = Filter(fac, filterStatement);

var myFeature = First(allElement);
var PopupStringB = Text(myFeature.TotalGHG, '###,###.0')
DefaultValue(popupStringB, 'no data')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:48:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259547#M50454</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2023-02-17T20:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Arcade Popup expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259606#M50456</link>
      <description>&lt;P&gt;Sorry about that. There was an extra "=" that I overlooked. Try this&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var filterStatement = "FacilityID = @this AND FiscalYear = '2021-2022'";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 00:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259606#M50456</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-02-18T00:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Arcade Popup expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259818#M50468</link>
      <description>&lt;P&gt;That worked!! Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 13:17:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-a-arcade-popup-expression/m-p/1259818#M50468</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2023-02-20T13:17:47Z</dc:date>
    </item>
  </channel>
</rss>

