<?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 for pop up in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226927#M48627</link>
    <description>&lt;P&gt;You'll have better luck working with an array. In your loop, use &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#push" target="_blank"&gt;&lt;STRONG&gt;Push&lt;/STRONG&gt;&lt;/A&gt; to add codes to an array.&lt;/P&gt;&lt;P&gt;Once you have an array with your values, you can simply use &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#distinct" target="_blank"&gt;&lt;STRONG&gt;Distinct&lt;/STRONG&gt;&lt;/A&gt; to remove duplicates.&lt;/P&gt;&lt;P&gt;Once you have your array of distinct values, use &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate" target="_blank"&gt;&lt;STRONG&gt;Concatenate&lt;/STRONG&gt;&lt;/A&gt; to create a comma-delimited string.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fsReArea = FeatureSetByName($datastore, "Regional_Area", ["*"], false)
var fsReAreaIntersect = Intersects(fsReArea, Geometry($feature))
var orderRA = OrderBy(fsReAreaIntersect, "objectid ASC")

var arr = []

for(var regionA in orderRA) {
    if(regionA.Region_Code != null) {
        Push(arr, regionA.Region_Code)
    }
}

return Concatenate(Distinct(arr), ',')&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 31 Oct 2022 03:00:26 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-10-31T03:00:26Z</dc:date>
    <item>
      <title>Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226921#M48626</link>
      <description>&lt;P&gt;Hello, I am seeking an advice for an Arcade expression for pop up in Map Viewer. What I would like to show in a field of pop up is, which features of Polygon class A are within the buffer feature of Polygon class B. To show that, the code does extracting attributes from Polygon feature A (Regional Area) that intersects with Polygon feature B (Buffer), and then populating the extracted attributes in a field of Polygon B. Also, when populating the attribute in the field, I would like to delete any duplicates of the extracted attributes and concatenate them with comma.&lt;/P&gt;&lt;P&gt;I kind of managed to prepare an expression for extracting values and concatenate them (see code below) but I am still new to Arcade, I have not found the way of deleting duplicate values and concatenate them with comma. i.e., current return includes all the duplicated values and concatenated (e.g. 1117111511131317) but I want to make it like (e.g. 11,13,15,17).&lt;/P&gt;&lt;P&gt;Thanks in advance for any Arcade expression solutions!&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fsReArea = FeatureSetByName($datastore, "Regional_Area", ["*"], false)
var fsReAreaIntersect = Intersects(fsReArea, Geometry($feature))
var orderRA = OrderBy(fsReAreaIntersect, "objectid ASC")
var arr = ""
for(var regionA in orderRA) {
    if(regionA.Region_Code != null) {
        arr += concatenate(regionA.Region_Code)
    }
}
return arr&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 30 Oct 2022 23:54:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226921#M48626</guid>
      <dc:creator>Aнастасия88</dc:creator>
      <dc:date>2022-10-30T23:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226927#M48627</link>
      <description>&lt;P&gt;You'll have better luck working with an array. In your loop, use &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#push" target="_blank"&gt;&lt;STRONG&gt;Push&lt;/STRONG&gt;&lt;/A&gt; to add codes to an array.&lt;/P&gt;&lt;P&gt;Once you have an array with your values, you can simply use &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#distinct" target="_blank"&gt;&lt;STRONG&gt;Distinct&lt;/STRONG&gt;&lt;/A&gt; to remove duplicates.&lt;/P&gt;&lt;P&gt;Once you have your array of distinct values, use &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate" target="_blank"&gt;&lt;STRONG&gt;Concatenate&lt;/STRONG&gt;&lt;/A&gt; to create a comma-delimited string.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fsReArea = FeatureSetByName($datastore, "Regional_Area", ["*"], false)
var fsReAreaIntersect = Intersects(fsReArea, Geometry($feature))
var orderRA = OrderBy(fsReAreaIntersect, "objectid ASC")

var arr = []

for(var regionA in orderRA) {
    if(regionA.Region_Code != null) {
        Push(arr, regionA.Region_Code)
    }
}

return Concatenate(Distinct(arr), ',')&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 31 Oct 2022 03:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226927#M48627</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-31T03:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226948#M48628</link>
      <description>&lt;P&gt;Thanks Josh for your help!&lt;/P&gt;&lt;P&gt;The return (&lt;SPAN&gt;11,17,13,15&lt;/SPAN&gt;) is nearly what I wanted but&amp;nbsp;I wanted the return in order like (11,13,15,17). As Region_code is text field, I updated the code like this:&lt;/P&gt;&lt;P&gt;var fsReAreaIntersect = Number(Intersects(fsReArea, Geometry($feature)))&lt;BR /&gt;var orderRA = OrderBy(fsReAreaIntersect, "Region_Code ASC").&lt;/P&gt;&lt;P&gt;But this did not work unfortunately. Is there any way of arranging the return values in order?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 06:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1226948#M48628</guid>
      <dc:creator>Aнастасия88</dc:creator>
      <dc:date>2022-10-31T06:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1227018#M48633</link>
      <description>&lt;P&gt;Fortunately, there's another array function, &lt;STRONG&gt;Sort&lt;/STRONG&gt;. Given an array of numeric values, it will by default sort them ascending.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Concatenate(Sort(Distinct(arr)), ',')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 13:27:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1227018#M48633</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-31T13:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1227263#M48641</link>
      <description>&lt;P&gt;Thanks a lot Josh! As a beginner, I thought OrderBy is only a function for sorting values..&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 21:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-pop-up/m-p/1227263#M48641</guid>
      <dc:creator>Aнастасия88</dc:creator>
      <dc:date>2022-10-31T21:22:36Z</dc:date>
    </item>
  </channel>
</rss>

