Select to view content in your preferred language

Arcade function to show unique values (remove duplicate values)

02-18-2021 05:42 PM
Status: Already Offered
Labels (2)
Regular Contributor II

When using the Table Attribute dynamic text function in ArcGIS Pro you can return a string of values visible in the map frame (i.e.1, 2, 3, 4,...). Sometimes you may have a dataset with multiple features with the same value (i.e.1, 2, 2, 2, 3, 3, 4,...).. By using this function in it's current format, you would see the results as per the example given, but sometimes you may want to only see Unique values (i.e. 1, 2, 2, 2, 3, 3, 4 would be returned as 1, 2, 3, 4). It would be good if there was an Arcade function that shows unique values, removing any duplicates (suggestion below). 



This post is another example of where this function would be useful: 


Great idea @LindsayRaabe_FPCWA !

Status changed to: Already Offered

You can put the values into an array and then use the Distinct function for this. This will work with numbers or text in an array, for example:


Distinct(["1", "2", "2", "2", "3", "3", "4"])




Distinct([1, 2, 2, 2, 3, 3, 4])


The Split function can help you construct an Array if you don't have one already.


@CraigWilliams  I'm not sure this works correctly in the Dynamic Text function. As per screenshot below, I don't get any values returned - just the delimiter. 






Support case lodged. #02745001 Removing duplicate values using DISTINCT arcade function in table value dynamic text not working


Just received this update;


"Thank you for your patience as we have investigated this issue. I just wanted to update you on this case. After extensive testing, it does appear that there is an issue with the Distinct function when used in the Table Attributes option for Dynamic Text. We were able to replicate this issue and found that a blank output was returned when applying the Distinct function as outlined in the Esri Community post that you sent through. 

Because of this, we have lodged a bug on the issue BUG-000137676: Unable to remove duplicates using 'Distinct' Arcade function in Table Attribute Value Dynamic Text in ArcGIS Pro. "


Hopefully see a fix in 2.8!


@LindsayRaabe_FPCWA Is there a fix for this in 2.8.1?


The bug mentioned above is showing as In Product Plan on the support site:

Meaning that it is not fixed in 2.8.1 or the current version of Pro which is 2.9.  But it looks like work is being done.

Not that I've figured out or that ESRI support has shown me. Not really satisfied with the explanation I got from them on this one.

Just looked into this - it's still in the Product Plan. Wish they would fix it already!

My Esri | Bug Details


I've been trying to make this work for three days and have just now discovered this is a bug.

Crickey. Two years to work on it and it isn't fixed yet? Git 'er done already.