Select to view content in your preferred language

Logical expressions in Attribute Rules (Arcade)

763
1
Jump to solution
10-02-2023 03:59 PM
Labels (3)
LorindaGilbert
Frequent Contributor

Hi,

Using Pro 3.x; writing Attribute Rules.  I've got an expression that it keeps saying that it needs a close parenthesis.  I've put this expression into Notepad ++ and it shows the matching parenthesis.  Doesn't seem to be any missing.  Is this perhaps a false message and I'm missing something else?  I am actually trying to mine the data in the comments field looking for each of those words/phrases (except I don't want the comments that have both STORMWATER and LIFT in them.  I did try those on the previous if statement, didn't work there either.  Any help appreciated, cause I'm just not seeing it.

Thanks,

Lorinda

var comments = $feature.Comments
var ckcomments = $feature.CheckComments
var discount = $feature.Discount

if (discount > 42) {
ckcomments = 'Y';
}
else if ((Find("WASTELAND",comments,0) >-1) || (Find("SUBMERGE",comments,0) >-1) || (Find("LAKE BOTTOM",comments,0) >-1) || (Find("POND",comments,0) >-1) || (Find("HOA",comments,0) >-1) || (Find("ZERO",comments,0) >-1)) {
ckcomments = 'Y';
}
else if ((Find("STORMWATER",comments,0) >-1) && (Find("LIFT",comments,0) = 1)) {
ckcomments = 'Y';
}
else {
ckcomments = 'N';
}
return ckcomments;

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Alum

To post formatted code:

JohannesLindner_0-1689266678674.pngJohannesLindner_1-1689266693900.png

 

Your check for LIFT is wrong. You use =, which is for assignment. You either want to use == for comparison, or (more probable) you want to use the same check > -1 you used for the other words.


Have a great day!
Johannes

View solution in original post

0 Kudos
1 Reply
JohannesLindner
MVP Alum

To post formatted code:

JohannesLindner_0-1689266678674.pngJohannesLindner_1-1689266693900.png

 

Your check for LIFT is wrong. You use =, which is for assignment. You either want to use == for comparison, or (more probable) you want to use the same check > -1 you used for the other words.


Have a great day!
Johannes
0 Kudos