Select to view content in your preferred language

Arcade Expression

88
6
yesterday
BSBlagojevic
Regular Contributor

Please, is any known how to get unique values from tables with many repeating, which I need in my report? I try with simple table query as below, but without success! Please, help me! As assistance attached both tables. In first table I need Unique's from field 'TipAlteracije' from second field 'Naziv'

Thank you very much! 

Distinct($featureSet, ["FieldName"])
0 Kudos
6 Replies
Robert_LeClair
Esri Esteemed Contributor

If you don't need to run Python, then the Frequency (Analysis Tools) | ArcGIS Pro documentation will do the job easily enough.

0 Kudos
BSBlagojevic
Regular Contributor

Robert_LeClair, Thank you! I'm going to see/try, but the expressions are limited to Arcade lng. only.

Best regards!

0 Kudos
Robert_LeClair
Esri Esteemed Contributor

In full transparency, the Esri Support AI Chatbot came back with this below.  It's somewhere to start in troubleshooting your expression:


Use Distinct() on a FeatureSet and pass both field names to get unique combinations of `Naziv` + `TipAlteracije`:

var u = Distinct($layer, ["Naziv", "TipAlteracije"])
return u

If you need it as a text list (for a report/dynamic text), concatenate the distinct rows:

var u = Distinct($layer, ["Naziv", "TipAlteracije"])

var s = ""
for (var r in u){
s += r.Naziv + " | " + r.TipAlteracije + TextFormatting.NewLine
}
return s

Reference: [Arcade FeatureSet functions — Distinct](https://developers.arcgis.com/arcade/function-reference/featureset_functions)

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

How is this question different from the one you posted Monday:  https://community.esri.com/t5/arcgis-pro-questions/arcade-expression/m-p/1716921#M104072

0 Kudos
BSBlagojevic
Regular Contributor

@JoshuaBixby, Thanks! The question is the same, but the attachments/tables from which I need unique values ​​are included. If you have time and can help, please write/explain how to get unique values. Distinct, at least in this case, simply doesn't not work!?!

THANKS, again!

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Posting sample data is always a great idea.  For future reference, you can go back and edit your original question to include the attachment and a note that says you attached it rather than creating a new post.

0 Kudos