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"}
Solved! Go to Solution.
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_
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_
@RhettZufelt, I should have known but I love it when the fix is easy:) Worked--thank you!