I originally started writing Arcade expressions in ArcGIS Online. Today I attempted to write an expression in Pro 2.6 with the intention of updating a webmap. I get errors in the Expression Builder that I don't get using AGOL. In ArcGIS Pro, the error states "Invalid expression. Error on line 1. Colon expected."
However, this expression works fine on the web version.
Why don't these work the same? Where does this colon go?
Solved! Go to Solution.
Thanks for the suggestion.
As it turns out, it doesn't care about the syntax for HH_Status. That works with both dots and square brackets. But Manhole_Type inside curly brackets was the violation.
if ($feature["HH_Status"] == 0) {return "Proposed " + $feature.Manhole_Type}
Edit: For my purposes, this worked:
if ($feature["HH_Status"] == 0) {return "Proposed " + DomainName($feature,"Manhole_Type")}
I think the difference is how you are referencing the feature attribute:
if($feature["HH_STATUS"] == 0)
// try replacing with:
if($feature.HH_STATUS == 0)
Joe, I don't think that is the issue, or should be. According to Esri's own documentation: Structure And Logic | ArcGIS for Developers
Attribute values can be referenced using the . syntax or with square brackets.
If changing between dot and bracket does change the result, then it is a defect.
Hence 'think' in italics. I've never written arcade for anything but Pro, and always used the $featureDotAttribute syntax...
Thanks for the suggestion.
As it turns out, it doesn't care about the syntax for HH_Status. That works with both dots and square brackets. But Manhole_Type inside curly brackets was the violation.
if ($feature["HH_Status"] == 0) {return "Proposed " + $feature.Manhole_Type}
Edit: For my purposes, this worked:
if ($feature["HH_Status"] == 0) {return "Proposed " + DomainName($feature,"Manhole_Type")}