I'm still learning Arcade myself, but it looks to me like you're definitely missing an open parenthesis on line 3. Try when((day_ = 1), "Sunday", "n/a")
Hi Richard Quodomine ,
I see a couple of errors in the expression and because of that I'm not entirely clear what you are trying to do. Let's include the code after the correction made by Nick Dierks to sove the missing parenthesis:
function RetWeekDay(text){
var day_ = $feature.DAY_OF_WEE;
var DOW = When((day_ = 1), "Sunday", "n/a");
DOW = RetWeewkDay;
return RetWeekDay;
}
Let me list some of the errors:
If you want to return the text "Sunday" when your attribute DAY_OF_WEE is 1, and "n/a" in all other cases, you can do something like:
if ($feature.DAY_OF_WEE == 1) {
return "Sunday";
} else {
return "n/a";
}
In order:
First, thank you both.
Second, I did have the double parens up in my first rendition. It kept looking for a close, but I had two.
Third, I should have been clearer, the When statement will go through all 7 days, with a 1 = Sunday, 2 = Monday, etc. I think I whiffed on the ==. I'll get back to all of you with the more complete code, after testing. Thank you!
So here it is:
var day_ = $feature.DAY_OF_WEE;
var DOW = when((day_ == 1), "Sunday", day_ == 2, "Monday", day_ == 3, "Tuesday", day_ == 4, "Wednesday", day_ == 5, "Thursday", day_ == 6, "Friday", day_ == 7, "Saturday", "n/a");
DOW
Thanks to both of you for the help. I was just doing a calculated field to get get a good symbology for some data I had. I really appreciate the guidance.