Select to view content in your preferred language

Arcade When() function not working with complex And statement

150
3
Jump to solution
01-31-2025 11:32 AM
MPach
by
Frequent Contributor

I'm trying to use a custom Arcade expression in Symbology to set the color of points in a feature layer. See below.

When($feature.Device_Due_Date > DateOnly(), "In Compliance",$feature.Device_Due_Date < DateOnly() && $feature.Device_Last_Test_Status = "fail", "Failing and Past Due",
      $feature.Device_Due_Date < DateOnly(), "Past Due",
      $feature.Device_Status = "Inactive")

 I've narrowed the problem down to the complex AND statement on the second clause in the When statement. If I make it a simple clause without the AND it works. 

Is there a way get the AND statement to work? I'm trying to set the color of the points based off of these logical statements. 

Here's a screen shot to see where I'm using the expression. 

MPach_0-1738351895170.png

 

Thank you

0 Kudos
1 Solution

Accepted Solutions
ZachBodenner
MVP Regular Contributor

What's the error you're getting? I think there's a chance it's because you use 

 

$feature.Device_Last_Test_Status = "fail",

 

when you need two equals signs:

$feature.Device_Last_Test_Status == "fail",
Happy mapping,
- Zach

View solution in original post

3 Replies
ZachBodenner
MVP Regular Contributor

What's the error you're getting? I think there's a chance it's because you use 

 

$feature.Device_Last_Test_Status = "fail",

 

when you need two equals signs:

$feature.Device_Last_Test_Status == "fail",
Happy mapping,
- Zach
MPach
by
Frequent Contributor

Thank you very much @ZachBodenner . Such a silly mistake.

0 Kudos
ZachBodenner
MVP Regular Contributor

No worries, I do the same thing routinely.

Happy mapping,
- Zach
0 Kudos