<?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: Use Distinct in Arcade Expression to return unique rows from table in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577280#M15430</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/358745"&gt;Don Sjoboen&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then that's where I think the error refers to. &amp;nbsp;I assume it will not any information on the fields that are not included in the Distinct fields.&amp;nbsp;Can you&amp;nbsp;return the customers just after the Distinct to verify?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jun 2020 22:27:04 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2020-06-24T22:27:04Z</dc:date>
    <item>
      <title>Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577272#M15422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to use DISTINCT in my Arcade expression (see below) in my web map popup, but am not getting the expected results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to return the unique route for each customer.&amp;nbsp; I'm relating this table to a point feature class.&amp;nbsp; I published my map service (to our ArcGIS Servers) with the point feature class and the two view tables, and using the FeatureSetByName $datastore for the var tbl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I Console(customers) to view the results, I get 'Object, FeatureSet'?&amp;nbsp; Does Distinct work on feature classes only or does it work with tables?&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/497634_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;Here's my Arcade expression...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var tbl = FeatureSetByName($datastore,"SWM Routes Table");&lt;BR /&gt;Console(Count(tbl));&lt;BR /&gt;var id = $feature["CO_ID"];&lt;BR /&gt;Console(id);&lt;BR /&gt;var sql = "CONNECTION_OBJECT = '" + id + "'";&lt;BR /&gt;Console(sql);&lt;BR /&gt;var customers = Distinct(Filter(tbl, sql), "ROUTE");&lt;BR /&gt;Console(customers);&lt;BR /&gt;var cnt = Count(customers);&lt;BR /&gt;Console(cnt);&lt;BR /&gt;var result = "";&lt;BR /&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt; for (var customer in customers) {&lt;BR /&gt; result += TextFormatting.NewLine + "Route: " + customer.ROUTE +&lt;BR /&gt; " / " + customer.Supervisor + " / " + customer.COLLECTION_DAY +&lt;BR /&gt;/* TextFormatting.NewLine + "Customer: " + customer.BP_Name +&lt;BR /&gt; TextFormatting.NewLine + "Business Partner: " + customer.BP_Num +&lt;BR /&gt; TextFormatting.NewLine + "Contract Account: " + customer.ContractAcct +*/&lt;BR /&gt; TextFormatting.NewLine;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;} else {&lt;BR /&gt; result = "No customer data"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Console(result);&lt;BR /&gt;return result;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone have experience with using Distinct in a related (1:M) table or have suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2020 16:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577272#M15422</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-23T16:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577273#M15423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/DSJOBOEN@ci.tacoma.wa.us_tacoma"&gt;DSJOBOEN@ci.tacoma.wa.us_tacoma&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A quick question: is you field "CONNECTION_OBJECT" string o numeric? If numeric, you should change the sql you use in the Filter (take out the quotes).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2020 20:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577273#M15423</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-06-23T20:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577274#M15424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields [CO_ID] &amp;amp; [CONNECTION_OBJECT] are integers.&amp;nbsp; I was able to get my Arcade expression to work with the Distinct function and still using double quotes for [CO_ID] and CONNECTION_OBJECT...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var tbl = FeatureSetByName($datastore,"SWM Routes Table");&lt;BR /&gt;Console('$datastore count: ' + Count(tbl));&lt;BR /&gt;var id = $feature["CO_ID"];&lt;BR /&gt;Console('id: ' + id);&lt;BR /&gt;var sql = "CONNECTION_OBJECT = '" + id + "'";&lt;BR /&gt;Console('sql: ' + sql);&lt;BR /&gt;var customers = Filter(tbl, sql);&lt;BR /&gt;var cnt = Count(customers);&lt;BR /&gt;Console('customers count: ' + cnt);&lt;/P&gt;&lt;P&gt;var fields = ["ROUTE", "Supervisor", "COLLECTION_DAY"];&lt;BR /&gt;customers = Distinct(customers, fields);&lt;BR /&gt;Console('customers distinct count: ' + Count(customers));&lt;BR /&gt;var result = "";&lt;BR /&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt; for (var customer in customers) {&lt;BR /&gt; result +="Route: " + customer.ROUTE +&lt;BR /&gt; " / " + customer.Supervisor + " / " + customer.COLLECTION_DAY +&lt;BR /&gt; TextFormatting.NewLine;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;} else {&lt;BR /&gt; result = "No customer data"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Console(result);&lt;BR /&gt;return result;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 14:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577274#M15424</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-24T14:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577275#M15425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/358745"&gt;Don Sjoboen&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, what I deduce from your answer is that the fields are numeric, and yet it works when you create a query as if the field is a string. I think I have seen this go wrong in the past and I would recommend against it, since it is not guaranteed that it will work in the future. I think it might even be possible to avoid this by using the query as:&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CONNECTION_OBJECT = @id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 19:57:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577275#M15425</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-06-24T19:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577276#M15426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ I will give that a go and see what happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On another note,&amp;nbsp;although I am using Console() in my arcade expression to check my logic, sometimes it returns as I would expect or not expect, meaning that I always don't get a function error, or invalid parameters message.&amp;nbsp; So, to me I think "okay this works" or "why is field not found?"... but, when I go thru the steps to view in the map popup window only to find out that there is no data returned!?&amp;nbsp; I wish there was a way the Arcade console could tell you (in the supported platforms) if the data result is NULL or invalid (i.e. no data returned) or to help you troubleshoot further.&amp;nbsp; For example... when using Distinct, if I only have the one field it&amp;nbsp;says field not found and yet I get no data when viewing the popup, although it found the 3 distinct records... I wish it would tell me that I need ALL fields referenced in the related table.&amp;nbsp; I am new at Arcade and am learning quick, but it was a little frustrating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;var fields = ["ROUTE"];&lt;/SPAN&gt;&lt;BR style="background-color: #ffffff;" /&gt;&lt;SPAN style="background-color: #ffffff;"&gt;customers = Distinct(customers, fields);&lt;/SPAN&gt;&lt;BR style="background-color: #ffffff;" /&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Console('customers distinct count: ' + Count(customers));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;IMG class="image-1 jive-image" height="75" src="https://community.esri.com/legacyfs/online/497807_pastedImage_1.png" width="233" /&gt;&amp;nbsp;&lt;IMG class="image-2 jive-image" height="152" src="https://community.esri.com/legacyfs/online/497808_pastedImage_2.png" width="241" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Perhaps a more detailed error like; please add all related fields or not all fields found or something to help indicate what the issue is...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;var fields = ["ROUTE", "Supervisor", "COLLECTION_DAY"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;customers = Distinct(customers, fields);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console('customers distinct count: ' + Count(customers));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;IMG class="image-3 jive-image" height="161" src="https://community.esri.com/legacyfs/online/497809_pastedImage_3.png" width="238" /&gt;&amp;nbsp;&lt;IMG class="jive-image image-4" height="155" src="https://community.esri.com/legacyfs/online/497810_pastedImage_4.png" width="216" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions or is that something ESRI team is aware of and working on improving?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:30:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577276#M15426</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-24T21:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577277#M15427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/358745"&gt;Don Sjoboen&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that when you create the result after distinct with 1 field, you only try to retrieve the ROUTE field and not the other fields, right? The fact that it shows the "customer distinct count: 3" implicates that the Distinct was executed correctly. A console statement that should be executed after an error occurs does not get executed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree that there is room for improvement when debugging an expression, but using these console statements help to determine where an error occurs.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:47:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577277#M15427</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-06-24T21:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577278#M15428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;No.&amp;nbsp; My for loop included all fields that I want returned or displayed in the popup when I referenced the ROUTE field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var result = "";&lt;BR /&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt; for (var customer in customers) {&lt;BR /&gt; result +="Route: " + customer.ROUTE +&lt;BR /&gt; " / " + customer.Supervisor + " / " + customer.COLLECTION_DAY +&lt;BR /&gt; TextFormatting.NewLine;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:51:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577278#M15428</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-24T21:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577279#M15429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Using the following seemed to work better, as I could see the message returned from the Console('sql: ' + sql);&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/497812_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/497813_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577279#M15429</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-24T21:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577280#M15430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/358745"&gt;Don Sjoboen&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then that's where I think the error refers to. &amp;nbsp;I assume it will not any information on the fields that are not included in the Distinct fields.&amp;nbsp;Can you&amp;nbsp;return the customers just after the Distinct to verify?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 22:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577280#M15430</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-06-24T22:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577281#M15431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;You are correct, I still get the error and the count results are still the same...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/497819_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="67" src="https://community.esri.com/legacyfs/online/497814_pastedImage_1.png" width="229" /&gt;&amp;nbsp;&lt;IMG class="image-2 jive-image" height="160" src="https://community.esri.com/legacyfs/online/497815_pastedImage_2.png" width="252" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 23:05:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/577281#M15431</guid>
      <dc:creator>DonSjoboen</dc:creator>
      <dc:date>2020-06-24T23:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1138551#M21862</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/144848"&gt;@DonSjoboen&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; - I know you guys were working on something a little different with this a while back but I wanted to share something similar since this post helped me out:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intParcels = Intersects($feature, FeatureSetByName($map, 'Community Flood Zone'));
var fpTypes = Distinct(intParcels, "zonetype");
var fpCnt = Count(fpTypes);
var fplist = '';

if (fpCnt &amp;gt; 0){
        for (var k in fpTypes)
        {
            fplist += ' Zone ' + k.zonetype;
        }
    
    } else {
        fplist = 'No Flood Zone intersects this parcel'
    }

return fplist;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, click on a parcel, return flood info from the Intersects.&amp;nbsp; Add a TextFormatting.NewLine at where needed.&lt;/P&gt;&lt;P&gt;Thanks-&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 21:20:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1138551#M21862</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2022-01-28T21:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1140508#M21887</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10568"&gt;@DavidColey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can do something like this (see below). Remember that the Distinct function returns and array and not a featureset:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intParcels = Intersects($feature, FeatureSetByName($map, 'Community Flood Zone'));

// this returns an array, not a featureset (and I sorted it)
var fpTypes = Sort(Distinct(intParcels, "zonetype")); 
var fpCnt = Count(fpTypes);
var fplist = '';

if (fpCnt &amp;gt; 0) {
    // create empty array
    var lst = [];
    // add the required text to the zones
    for (var i in fpTypes) {
        Push(lst, '- Zone: ' + fpTypes[i]);
    }
    // concatenate with new line
    fplist = Concatenate(lst, TextFormatting.NewLine);    
} else {
    fplist = 'No Flood Zone intersects this parcel'
}

return fplist;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Feb 2022 19:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1140508#M21887</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2022-02-03T19:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1148787#M21956</link>
      <description>&lt;P&gt;fyi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;, this returns an Illegal Argument error in the Map Viewer Arcade editor.&amp;nbsp; But that's ok because I'm not treating it as an array.&amp;nbsp; However, if you have an idea on how to get DomanName descriptions to return from the Distinct that would help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because FeatureSetByName here is using the $map profile, I can't seem to get the Distinct to return coded value descriptions, as if I were using the $feature profile....&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 21:13:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1148787#M21956</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2022-02-28T21:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1151506#M21975</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10568"&gt;@DavidColey&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way to go is to get the code a translate it to the description making use of the domain function. You can use something like the example below to get a dictionary of the domain and use that dictionary to translate the description based on the code.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetDomainDct(lay, fldname) {
    var dom = Domain(lay, fldname);
    var cvs = dom["codedValues"];
    var dct = {};
    for (var i in cvs) {
        var cv = cvs[i];
        dct[cv["code"]] = cv["name"];
    }
    return dct;    
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 21:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1151506#M21975</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2022-03-07T21:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1151687#M21980</link>
      <description>&lt;P&gt;Ah yes thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; - I was looking at DomainName, but realized I had no method to get a return of descriptions.&amp;nbsp; I'll work on this between dev conference sessions this week and post back what I can put together.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 13:41:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1151687#M21980</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2022-03-08T13:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Use Distinct in Arcade Expression to return unique rows from table</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1155003#M22003</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; - here's some of what I came up with:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intParcel = Intersects(Centroid($feature), FeatureSetByName($map,"County Zoning", ['zoningdesignation'], true));
var fldname = 'zoningdesignation';

var znType = Distinct(intParcel, fldName);
var znCnt = Count(znType);
var znlist = '';

function GetDomainDct() {
    var dom = Domain(intParcel, fldname);
    var cvs = dom["codedValues"];
    var dct = {};
    for (var i in cvs) {
        var cv = cvs[i];
        dct[cv["code"]] = cv["name"];
    }
    return dct;    
}
var rt = GetDomainDct();

if (znCnt &amp;gt; 0){
  for (var k in znType) {
        znlist = rt[k.zoningdesignation]; //needs to be an array
            
    }
} else {
      znlist = 'Zoning Information Missing'
    }
return znlist;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was struggling with how to return the function until I realized I needed to set it to a var (via the Arcade Help) and then from that point it was simply a matter of making sure list was set to return an array as well.&amp;nbsp; I have another piece that does not use the centroid, but then removes the self-intersecting zoning type, and returns the types that are adjacent:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var lstZoning = FeatureSetByName($map, 'County Zoning', ['zoningdesignation'], true);
var intParcel = $feature;
var numZones = Count(Intersects(lstZoning, intParcel));
var intZoning = Intersects(Centroid(intParcel),lstZoning);
var allZoning = Intersects(intParcel,lstZoning);

var znTypes = Distinct(intZoning, "zoningdesignation");
var allTypes = Distinct(allZoning, "zoningdesignation");
var initialZT = "";
var znlist = '';

function GetInitDomainDct() {
    var dom = Domain(intZoning, "zoningdesignation");
    var cvs = dom["codedValues"];
    var dct = {};
    for (var i in cvs) {
        var cv = cvs[i];
        dct[cv["code"]] = cv["name"];
    }
    return dct;    
}
var rt = GetInitDomainDct();

function GetDomainDct() {
    var domAll = Domain(allZoning, "zoningdesignation");
    var cvsAll = domAll["codedValues"];
    var dctAll = {};
    for (var j in cvsAll) {
        var cvAll = cvsAll[j];
        dctAll[cvAll["code"]] = cvAll["name"];
    }
    return dctAll;    
}
var rtAll = GetDomainDct();

for (var k in znTypes)
    {
        initialZT = rt[k.zoningdesignation];
    }
    
if (numZones &amp;gt; 0){
    for (var m in allTypes){
        znlist += TextFormatting.NewLine + rtAll[m.zoningdesignation];
    }
} else {
    znlist = 'No zoning intersects this parcel'
}

var noZone = 'No zoning types border this parcel'
var newList = TextFormatting.NewLine + Trim(Replace(znlist,initialZT,"")); //Trim removes blank space left from replace

if (IsEmpty(Trim(Replace(znlist,initialZT,"")))){
    return noZone;
} else {
    return newList;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only problem is, is that it has to run things twice.&amp;nbsp; If you have any ideas on how to make this more concise that would be great -&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 20:20:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/use-distinct-in-arcade-expression-to-return-unique/m-p/1155003#M22003</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2022-03-17T20:20:47Z</dc:date>
    </item>
  </channel>
</rss>

