Attribute Rule Expressions error message "Identifier Expected"

744
1
Jump to solution
12-29-2022 01:58 PM
Labels (3)
SaraHedrick1
New Contributor III

I've tried a few different methods to resolved this issue, but I can't figure out what it doesn't like. I'm more comfortable with Python, but attribute rules only except Arcade. I've tried to follow the guidelines laid out here. I don't have semi-colons here because it isn't in the instructions in the link provided, but I did try with semi-colons at the end of the lines. 

var value = $feature.Code;
if (Left(value, 1)) == "0A" {return "Eastern"}
if (Left(value, 2)) == "0B" {return "Northern"}
if (Left(value, 2)) == "0C" {return "Southern"}
if (Left(value, 2)) == "0D" {return "Western"}
else {return "Other"}

0 Kudos
1 Solution

Accepted Solutions
GoWest
by
New Contributor III

You had parenthesis in the wrong place.
See if this code fixes your problem:

var value = $feature.Code;
if (Left(value, 1) == "0A") {return "Eastern"}
if (Left(value, 2) == "0B") {return "Northern"}
if (Left(value, 2) == "0C") {return "Southern"}
if (Left(value, 2) == "0D") {return "Western"}
else {return "Other"}

View solution in original post

0 Kudos
1 Reply
GoWest
by
New Contributor III

You had parenthesis in the wrong place.
See if this code fixes your problem:

var value = $feature.Code;
if (Left(value, 1) == "0A") {return "Eastern"}
if (Left(value, 2) == "0B") {return "Northern"}
if (Left(value, 2) == "0C") {return "Southern"}
if (Left(value, 2) == "0D") {return "Western"}
else {return "Other"}

0 Kudos