Portal 10.6.1 Bug or Arcade Syntax Error?

580
3
Jump to solution
09-12-2019 10:17 AM
AmyRoust
Occasional Contributor III

I'm running Portal for ArcGIS 10.6.1 and trying to use an Arcade Attribute Expression to populate a pop-up. Here is my syntax:

"The setback for the " + Proper($feature.FUNCTCLASS) + " road class is " +
Decode($feature.FUNCTCLASS,
"FREEWAY","150 feet ",
"PRINCIPAL ARTERIAL","150 feet ",
"MINOR ARTERIAL","100 feet ",
"MAJOR COLLECTOR","100 feet ",
"MINOR COLLECTOR","75 feet ",
"STREET","50 feet ",
unknown)
+ "and the road frontage is " +
Decode($feature.FUNCTCLASS,
"FREEWAY","1320 feet.",
"PRINCIPAL ARTERIAL","1320 feet.",
"MINOR ARTERIAL","500 to 660 feet.",
"MAJOR COLLECTOR","500 to 660 feet.",
"MINOR COLLECTOR","330 feet.",
"STREET","250 feet.",
unknown)

The syntax checks out when I test it:

Successful test of code

But I cannot get it to show up in the actual pop-up. I've tried using Display by "A description from one field" and selecting the expression from the drop-down list; I've also tried "A custom attribute display" with a reference to the expression. Either way, the sentence shown in the Value portion of the test above does not appear in the pop-up. When I go back into the pop-up settings, the options have reset to "A description from one field" and my expression is still saved in the Attribute Expressions section.

I thought this might be a 10.6.1 bug and I did find and install patch ArcGIS-1061-PFA-SEC2019U1-Patch, but that didn't fix the issue. I also tried to put the same expression into ArcGIS Online, but I got the same result.

Maybe Decode isn't supported for pop-ups in 10.6.1? I checked the version matrix, but I'm not certain that I'm reading the chart right.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi  Amy Roust ,

The easiest way would be to leave the decode out and test with a dummy text to see if the Decode is the reason for the expression not to work. A way to leave out Decode is using dictionaries like this:

var functclass = $feature.FUNCTCLASS;

var dct_setback = {"FREEWAY": "150 feet ",
                   "PRINCIPAL ARTERIAL":"150 feet ",
                   "MINOR ARTERIAL": "100 feet ",
                   "MAJOR COLLECTOR": "100 feet ",
                   "MINOR COLLECTOR": "75 feet ",
                   "STREET": "50 feet "};

var dct_frontage = {"FREEWAY": "1320 feet.",
                    "PRINCIPAL ARTERIAL": "1320 feet.",
                    "MINOR ARTERIAL": "500 to 660 feet.",
                    "MAJOR COLLECTOR": "500 to 660 feet.",
                    "MINOR COLLECTOR": "330 feet.",
                    "STREET": "250 feet."}

var setback = "unknown";
if (HasKey(dct_setback, functclass)){
    setback = dct_setback[functclass];
}

var frontage = "unknown";
if (HasKey(dct_frontage, functclass)){
    frontage = dct_frontage[functclass];
}

return "The setback for the " + Proper(functclass) + " road class is " + setback + "and the road frontage is " + frontage;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

3 Replies
XanderBakker
Esri Esteemed Contributor

Hi  Amy Roust ,

The easiest way would be to leave the decode out and test with a dummy text to see if the Decode is the reason for the expression not to work. A way to leave out Decode is using dictionaries like this:

var functclass = $feature.FUNCTCLASS;

var dct_setback = {"FREEWAY": "150 feet ",
                   "PRINCIPAL ARTERIAL":"150 feet ",
                   "MINOR ARTERIAL": "100 feet ",
                   "MAJOR COLLECTOR": "100 feet ",
                   "MINOR COLLECTOR": "75 feet ",
                   "STREET": "50 feet "};

var dct_frontage = {"FREEWAY": "1320 feet.",
                    "PRINCIPAL ARTERIAL": "1320 feet.",
                    "MINOR ARTERIAL": "500 to 660 feet.",
                    "MAJOR COLLECTOR": "500 to 660 feet.",
                    "MINOR COLLECTOR": "330 feet.",
                    "STREET": "250 feet."}

var setback = "unknown";
if (HasKey(dct_setback, functclass)){
    setback = dct_setback[functclass];
}

var frontage = "unknown";
if (HasKey(dct_frontage, functclass)){
    frontage = dct_frontage[functclass];
}

return "The setback for the " + Proper(functclass) + " road class is " + setback + "and the road frontage is " + frontage;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
AmyRoust
Occasional Contributor III

Yes, it looks like the Decode function was tripping things up. I copy/pasted your code and it works great! I wasn't exactly using Decode in the spirit of how it was intended, so I'm not surprised that there was an issue.

Thanks!

XanderBakker
Esri Esteemed Contributor

Hi aroust , 

Glad it is working now!

0 Kudos