<?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 Where to 'close parenthesis'? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243011#M63672</link>
    <description>&lt;P&gt;A relative beginner here in Arcade, as well as to posting questions on forums, but I can't find a solution for this particular issue...&lt;/P&gt;&lt;P&gt;I'm working in ArcPro, attempting to build a table using the Insert Table Attribute/Dynamic Text Element with a custom Arcade expression (Arcade being the only choice available). My first task is to remove or reduce duplicate Project_IDs that are paired with associated Site_IDs. Being familiar with Javascript, I tried several methods such as reduce() and forEach(), but kept ending up with the same error:&lt;/P&gt;&lt;P&gt;'Invalid expression. Error on line 6. Close parenthesis expected'&lt;/P&gt;&lt;P&gt;There are no syntax errors detected using VS Code, etc. And yet I'm at a loss...&lt;/P&gt;&lt;P&gt;Here's the code as it is now:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var pID = [$feature.PROJECT_ID];

function removeDuplicates(pID) {
var unique = [];
for(i=0; i &amp;lt; pID.length; i++){
if(unique.indexOf((pID[i]) === -1)){
unique.push(pID[i])
}
}
return unique;
}
return removeDuplicates(pID);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 17:52:13 GMT</pubDate>
    <dc:creator>Philip_Ruthstrom</dc:creator>
    <dc:date>2022-12-21T17:52:13Z</dc:date>
    <item>
      <title>Where to 'close parenthesis'?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243011#M63672</link>
      <description>&lt;P&gt;A relative beginner here in Arcade, as well as to posting questions on forums, but I can't find a solution for this particular issue...&lt;/P&gt;&lt;P&gt;I'm working in ArcPro, attempting to build a table using the Insert Table Attribute/Dynamic Text Element with a custom Arcade expression (Arcade being the only choice available). My first task is to remove or reduce duplicate Project_IDs that are paired with associated Site_IDs. Being familiar with Javascript, I tried several methods such as reduce() and forEach(), but kept ending up with the same error:&lt;/P&gt;&lt;P&gt;'Invalid expression. Error on line 6. Close parenthesis expected'&lt;/P&gt;&lt;P&gt;There are no syntax errors detected using VS Code, etc. And yet I'm at a loss...&lt;/P&gt;&lt;P&gt;Here's the code as it is now:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var pID = [$feature.PROJECT_ID];

function removeDuplicates(pID) {
var unique = [];
for(i=0; i &amp;lt; pID.length; i++){
if(unique.indexOf((pID[i]) === -1)){
unique.push(pID[i])
}
}
return unique;
}
return removeDuplicates(pID);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 17:52:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243011#M63672</guid>
      <dc:creator>Philip_Ruthstrom</dc:creator>
      <dc:date>2022-12-21T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Where to 'close parenthesis'?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243024#M63675</link>
      <description>&lt;P&gt;There are some syntax differences in Javascript and Arcade code. Here's a revised version showing those differences ("==" instead of "===", "Count" instead of "length", and the IndexOf and Push syntax).&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var pID = [$feature.PROJECT_ID];

function removeDuplicates(pID) {
  var unique = [];
  for(var i=0; i &amp;lt; Count(pID); i++){
    if(IndexOf(unique, (pID[i])) == -1){
      Push(unique, pID[i])
    }
  }
  return unique;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 18:20:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243024#M63675</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-12-21T18:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Where to 'close parenthesis'?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243080#M63681</link>
      <description>&lt;P&gt;Ah, I figured there were some key differences between the two. The changes you made do 'solve' the error, however it returns only a delimiter for each record, while removing none of the duplicates.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 20:30:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243080#M63681</guid>
      <dc:creator>Philip_Ruthstrom</dc:creator>
      <dc:date>2022-12-21T20:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Where to 'close parenthesis'?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243101#M63684</link>
      <description>&lt;P&gt;What does your data look like? That would make it easier to figure out how to return the unique values.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 21:18:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243101#M63684</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-12-21T21:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Where to 'close parenthesis'?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243106#M63685</link>
      <description>&lt;P&gt;I have a list of Project_IDs that have one or more Site_IDs, and I'm trying to list the sites under their respective projects (projectA -&amp;gt; Site1, Site2) instead of listing them individually (projectA -&amp;gt; Site1, ProjectA -&amp;gt; Site2)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="attributes.jpg" style="width: 286px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59061iB40DE288E7E6B612/image-size/large?v=v2&amp;amp;px=999" role="button" title="attributes.jpg" alt="attributes.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'll apply the changes you detailed earlier to the other methods I tried and see if it comes up with anything different.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 21:31:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/where-to-close-parenthesis/m-p/1243106#M63685</guid>
      <dc:creator>Philip_Ruthstrom</dc:creator>
      <dc:date>2022-12-21T21:31:05Z</dc:date>
    </item>
  </channel>
</rss>

