Using data expression to return duplicate values in a dashboard list

563
20
07-17-2024 06:20 AM
Labels (1)
sophered
New Contributor III

Hello! I am trying to isolate and display duplicate values in a field in a dashboard list element. I was thinking of using the distinct function to do this but have not had any luck. Here is what I have so far! 

var portal = Portal('portal')
var fs = FeatureSetByPortalItem(portal, "itemid", 0, ['*'],true)
var uniquevalues = Distinct(fs, "fieldname")
return Filter(fs, "fieldname NOT IN @uniquevalues")

 

0 Kudos
20 Replies
jcarlson
MVP Esteemed Contributor

Oh, interesting. Yeah, you could try that.

distinct(
  fs,
  {name: 'some-field', expression: 'LEFT(some-field, 10)'}
)

Whether or not "LEFT" works depends on the underlying database. You can try SUBSTRING, too.

https://doc.arcgis.com/en/arcgis-online/reference/sql-agol.htm

LEFT isn't in the list, but that list isn't comprehensive. If the function is available in your RDBMS, you should be able to use it in Arcade.

- Josh Carlson
Kendall County GIS
0 Kudos