<?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: Listing polygon names that another polygon intersects in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213292#M47939</link>
    <description>&lt;P&gt;Here's another way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var cityList = []
for(var c in inCity) {
    Push(cityList, c.CTU_NAME)
}
if(Count(cityList) &amp;gt; 1) {
    cityList[-1] = "and " + cityList[-1]
}
var cityString = Concatenate(cityList, ", ")
cityString = Replace(cityString, ", and", " and")
return "This park is in: " + cityString&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 16 Sep 2022 08:11:32 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-09-16T08:11:32Z</dc:date>
    <item>
      <title>Listing polygon names that another polygon intersects</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213141#M47929</link>
      <description>&lt;P&gt;Hello! I am currently writing an expression to list all of the cities (or just a single city) that a park area is in. I was able to get a loop to find and list all of the cities/city returned, just formatting it is my last issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently what is returned is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="list.PNG" style="width: 154px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/51364iCFFE83B2774643CF/image-dimensions/154x106?v=v2" width="154" height="106" role="button" title="list.PNG" alt="list.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="single list.PNG" style="width: 105px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/51365i40DACE0A93EEE67D/image-dimensions/105x56?v=v2" width="105" height="56" role="button" title="single list.PNG" alt="single list.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;which depends on how many cities the park is in. (here is the expression)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="code.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/51366iD576CCF474CACCE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="code.PNG" alt="code.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ideally, I would want the list to look more like&lt;/P&gt;&lt;P&gt;"This park is in: City1, City2, and City3"&lt;/P&gt;&lt;P&gt;or "This park is in: City1 and City2"&lt;/P&gt;&lt;P&gt;or "This park is in: City1"&lt;/P&gt;&lt;P&gt;(obviously, it would depend on the number of cities the park is in)&lt;/P&gt;&lt;P&gt;Does anyone have a solution to adding commas between city names, while not having a comma after the last city, but having an and before the last one (if possible)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213141#M47929</guid>
      <dc:creator>Leahr</dc:creator>
      <dc:date>2022-09-15T20:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Listing polygon names that another polygon intersects</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213184#M47934</link>
      <description>&lt;P&gt;Here's one way to do that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var textArray = ['City 1', 'City 2', 'City 3'];
var output = 'This park is in: '
if (Count(textArray) == 1) return `${output} ${textArray[0]}`;
else if (Count(textArray) == 2) return `${output} ${Concatenate(textArray, ' and ')}`
else {
    for (var i in textArray) {
        if (i &amp;lt; count(textArray) - 1) output += `${textArray[i]}, `;
        else output += `and ${textArray[i]}`;
    }
    return output
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 21:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213184#M47934</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-09-15T21:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Listing polygon names that another polygon intersects</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213292#M47939</link>
      <description>&lt;P&gt;Here's another way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var cityList = []
for(var c in inCity) {
    Push(cityList, c.CTU_NAME)
}
if(Count(cityList) &amp;gt; 1) {
    cityList[-1] = "and " + cityList[-1]
}
var cityString = Concatenate(cityList, ", ")
cityString = Replace(cityString, ", and", " and")
return "This park is in: " + cityString&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:11:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213292#M47939</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-16T08:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Listing polygon names that another polygon intersects</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213979#M47962</link>
      <description>&lt;P&gt;Hi Johannes!&lt;/P&gt;&lt;P&gt;It worked, thanks so much&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 21:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/listing-polygon-names-that-another-polygon/m-p/1213979#M47962</guid>
      <dc:creator>Leahr</dc:creator>
      <dc:date>2022-09-19T21:01:49Z</dc:date>
    </item>
  </channel>
</rss>

