Select to view content in your preferred language

Error customizing road symbology with Arcade

328
2
Jump to solution
07-29-2024 10:55 AM
NiColahh
Occasional Contributor

I am creating a map in ArcGIS Pro that will eventually be published to ArcGIS Online and I cannot get my Arcade code to work for custom symbology. The code and syntax error are below. The error is 'Invalid expression. Error on line 10. Identifier expected.' Does anyone know how I can resolve this error? I'm writing this code to reclassify road symbology based on some detailed criteria via Arcade so that the layer can be symbolized accordingly on the fly without having to alter the underlying data.

 

 

var RN = $feature.RouteName
var SN = $feature.StreetName
var RC = $feature.RouteClass
var FC = $feature.FuncClass

if(RC == '3' || RC == '6') {return "State Route"}

else if(RN == 'FED-900' || SN == 'Blue Ridge Parkway' || SN == 'Blue Ridge Pkwy' || SN == 'Blue Ridge Pky' || RN == 'FED-902' || RN == 'FED-903' || RN == 'FED-901') {return "Blue Ridge Pkwy"}

else((RC == '1') || (RC == '80' && FC <> 7 && FC <> 4 && FC <> 6 && FC <> 2 && FC <> 3)) {return "Interstate"}

 

 

NiColahh_0-1722275068240.png

 

1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor

You shouldn't have any conditions in an else statement, just a return.  

This reads: if the "if" is false, and the "else if" is false, then return:

((RC == '1') || (RC == '80' && FC <> 7 && FC <> 4 && FC <> 6 && FC <> 2 && FC <> 3)) {return "Interstate"}

else is used to return a value if the if, and else if return False.

Similar example here.

R_

View solution in original post

2 Replies
RhettZufelt
MVP Notable Contributor

You shouldn't have any conditions in an else statement, just a return.  

This reads: if the "if" is false, and the "else if" is false, then return:

((RC == '1') || (RC == '80' && FC <> 7 && FC <> 4 && FC <> 6 && FC <> 2 && FC <> 3)) {return "Interstate"}

else is used to return a value if the if, and else if return False.

Similar example here.

R_

NiColahh
Occasional Contributor

@RhettZufelt, I should have known but I love it when the fix is easy:) Worked--thank you!

0 Kudos