Hi everyone, I would like to labeling just the fields with higher value then i used the expression above:
IIf($feature.cota == Max($rel_curva_nivel_l.cota), $feature.cota, Null)
But returned the following error:
Object not found $rel_curva_nivel_l
Could someone give me some help? Thanks in advance.
$rel_curva_nivel_l.cota
This doesn't look like a notation that Arcade would recognize. Where is this coming from?
I tried to use instructions from Chatgpt.
This will probably change in the future, but ChatGPT got a lot of its training before there was a tremendous amount of documentation on Arcade. It's very very unreliable right now.
If I read your code correctly, you have a feature class where you want to compare two fields, "cote" and "rel_curva_nivel_l", and then make the label show whichever is the higher value?
Actually the rel_curva_nivel_ is a feature class where the field "cote" exists. My intention is the expression sees the higher value in this field and only labeling this value.
So there are multiple features in that feature class, but only the one with the highest value should be labeled? I think you might do something like this. I haven't tested this and the syntax will depend on if you're doing this in Pro, map viewer, etc. In this case, it's in a web map:
//get all the features in your dataset
var p = featuresetbyname($map,"rel_curva_nivel_l")
// initialize an individual feature's "cota"
var c = $feature.cota
// identify the maximum value of "cota' within the entire feature class
var n = Max(p.cota)
// If the feature's "cota" is the same as the largest, return it, otherwise null
IIf(c == n, c, Null)
Yeah, you got the logic, but there are a lot of features with high values and i just want to label thoses.
I tested here but returned this following error:
Object not found $map
My map's name called Map, so i didn't know why didn't recognize.
You must be working in Pro? If that's the case, you'd probably need to use the $datastore. Here's an example from an attribute rule of mine which might work in labeling. There's just so many different profiles for arcade that all behave a little differently, so you'll have to guess and check:
var trees = FeatureSetByName($datastore, "epgdb.PARKS.TreeInventory")
so this is a feature class in an enterprise geodatabase called "epgdb" in the "PARKS" schema, feature class name TreeInventory. If your data is in a file geodatabase, I believe you can notate it with the just databaseName.featureclassName
I really glad for your help but now return Object not found $datastore kkk, i'll give up for while. In another moment i return to this.
Best Regards!