Select to view content in your preferred language

How to return unique values from the field/column of table fgdB?

390
13
a week ago
BSBlagojevic
Regular Contributor

How to return unique values from the field/column of table fgdB which participates in the relationship 1:M? I need unique values for the related report. Distinct keyword in Arcade does not do this on field/column (only on array, tested), and in SQL for file geodatabase this keyword is not supported!

Thanks for any help!

0 Kudos
13 Replies
KenBuja
MVP Esteemed Contributor

You're using the incorrect syntax for the Distinct function for a FeatureSet. It should be 

Distinct($layer, 'fieldName')
//or 
Distinct($layer, ['fieldName1', 'fieldName2'])

 

BSBlagojevic
Regular Contributor

THANK YOU for HELP! in both cases receive these messages (see screenshot below). 

0 Kudos
KenBuja
MVP Esteemed Contributor

What are you trying to do with this code? This affects what profile variables and functions you're able to use in your code. For example, labeling and visualization gives you a very limited set of profile variables and function bundles for efficiency reasons, whereas field calculations and popups give you more.

In any case, you can't use "$Kartirane geoloske jedinice", since that is not a FeatureSet variable.

0 Kudos
BSBlagojevic
Regular Contributor

THANK YOU VERY MUCH! In the first question I explained that I want to return unique values ​​from a field/column of the fgdB table that participates in a 1:M relationship, so that I can create a report. "$Kartirane geoloske jedinice"("$Mapped geological units") is an alias of FC/layer name, and ''Peferisana starost''(''Preferred age'') is the name (alias) of the field/column from which I need to return unique values.

Best Regards!

Branislav

0 Kudos
KenBuja
MVP Esteemed Contributor

The Distinct function for FeatureSets has the syntax

Distinct(features, fields)

with the "features" variable being a FeatureSet and the "fields" variable being either a single field name or an array of field names.

How you get the features variable depends on where you're using the Arcade code. It could be using the variable $datastore or $layer. Or you might need to get it from a function like FeatureSetByName or FeatureSetByPortalItem

What do you get if you use this in your code?

Distinct($layer, "Peferisana starost")

 

0 Kudos
BSBlagojevic
Regular Contributor

THANKS, and sorry for delay! See part of the original field and equivalency what should be done in attached screenshots.

 Regards!

P.S. I used explicitly layer name, field name i.e. its aliases from/inside fgdB.

 

0 Kudos
BSBlagojevic
Regular Contributor

With my code Distinct($layer, "Peferisana starost") result is 

BSBlagojevic_0-1758319972572.png

Branislav

0 Kudos
KenBuja
MVP Esteemed Contributor

You're using the layer name instead of "$layer"

0 Kudos
BSBlagojevic
Regular Contributor

Please excuse me, I was not able to answer you yesterday. I experimented with more code syntax (see attached of your proposal), but without success. Thanks for your time, obviously I have to look for another solution. I also tried with 'join outer', FC and tables, the result was also unsuccessful
 @AlyciaRajendran_esri, please help!

BEST Regards!

0 Kudos