<?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 writing Arcade to get distinct values from intersection in Field Maps in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420213#M59103</link>
    <description>&lt;P&gt;Awesome starting point. Changed my layer and field names and tested it out with the below results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LindsayRaabe_FPCWA_0-1715128362678.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103408i73782D636074E853/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_0-1715128362678.png" alt="LindsayRaabe_FPCWA_0-1715128362678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just need to work on it a bit to filter out the "0" values (where no Year value exists) and sort from oldest to most recent (as well as the formatting to just return a value instead of the table and "text" values).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 00:34:00 GMT</pubDate>
    <dc:creator>LindsayRaabe_FPCWA</dc:creator>
    <dc:date>2024-05-08T00:34:00Z</dc:date>
    <item>
      <title>Help writing Arcade to get distinct values from intersection in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1417913#M59001</link>
      <description>&lt;P&gt;I'm anticipating a problem I'm going to need to solve next week and don't believe my knowledge is up to it. Sooooo, I'm hoping the brains trust can help me out!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will have 2 polygon layers in Field Maps. One contains features (plantation areas) and another will have a new feature added to it which intersects with multiple plantation areas. What I want to achieve is an arcade script that runs an intersect between the 2 layers (which I know how to do) but then takes the planting year of all the intersect plantation areas (e.g. 1992, 1992, 1992, 1995, 1996, 1996, ...) and return a concatenated string of the Distinct values (e.g. 1992, 1995, 1996, ...). This string will then get passed to Survey123 to auto populate a field in the survey.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 05:32:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1417913#M59001</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2024-05-02T05:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help writing Arcade to get distinct values from intersection in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420006#M59095</link>
      <description>&lt;P&gt;Should be able to. I'm not super familiar with field maps. If I've got a good read on what you're asking for I think it looks something like&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var poly1 = FeatureSetByName($map, "Plantation Areas")
var intersects = Intersects(Geometry($feature), poly1)
var distinct_planting = []
var display_output = ""

for(var f in intersects) {
  Push(distinct_planting, f['plantation_year_field'])
}

distinct_planting = Distinct(distinct_planting)

for (var pyear in distinct_planting) {
  display_output = display_output + distinct_planting[pyear] + ' '
}

display_output = Trim(display_output)

return { 
	type : 'text', 
	text : display_output
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 17:03:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420006#M59095</guid>
      <dc:creator>JohnEvans6</dc:creator>
      <dc:date>2024-05-07T17:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help writing Arcade to get distinct values from intersection in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420213#M59103</link>
      <description>&lt;P&gt;Awesome starting point. Changed my layer and field names and tested it out with the below results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LindsayRaabe_FPCWA_0-1715128362678.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103408i73782D636074E853/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_0-1715128362678.png" alt="LindsayRaabe_FPCWA_0-1715128362678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just need to work on it a bit to filter out the "0" values (where no Year value exists) and sort from oldest to most recent (as well as the formatting to just return a value instead of the table and "text" values).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 00:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420213#M59103</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2024-05-08T00:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help writing Arcade to get distinct values from intersection in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420215#M59104</link>
      <description>&lt;P&gt;Modified to sort values (Line 10), exclude 0 values &amp;nbsp;(Line 7) and return just the output value (Line 18).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LindsayRaabe_FPCWA_1-1715128780181.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103409i03284145C7CC1B2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_1-1715128780181.png" alt="LindsayRaabe_FPCWA_1-1715128780181.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;var poly1 = FeatureSetByName($map, "FPC Plantations")
var intersects = Intersects(Geometry($feature), poly1)
var distinct_planting = []
var display_output = ""

for(var f in intersects) {
  iif(f['EstabYear']==0,"",Push(distinct_planting, f['EstabYear']))
}

distinct_planting = Distinct(Sort(distinct_planting))

for (var pyear in distinct_planting) {
  display_output = display_output + distinct_planting[pyear] + ' '
}

display_output = Trim(display_output)

return(display_output)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And further modified to separate with commas and spaces ', ' (Line 13) plus removing the last comma and space (Line 16) which negates the need for the Trim function which only removed the original trailing space.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LindsayRaabe_FPCWA_0-1715129850595.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103415i7113504A11C58C1E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_0-1715129850595.png" alt="LindsayRaabe_FPCWA_0-1715129850595.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;var poly1 = FeatureSetByName($map, "FPC Plantations")
var intersects = Intersects(Geometry($feature), poly1)
var distinct_planting = []
var display_output = ""

for(var f in intersects) {
  iif(f['EstabYear']==0,"",Push(distinct_planting, f['EstabYear']))
}

distinct_planting = Distinct(Sort(distinct_planting))

for (var pyear in distinct_planting) {
  display_output = display_output + distinct_planting[pyear] + ', '
}

return(Left(display_output, Count(display_output)-2))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 01:00:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-writing-arcade-to-get-distinct-values-from/m-p/1420215#M59104</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2024-05-08T01:00:42Z</dc:date>
    </item>
  </channel>
</rss>

