AnsweredAssumed Answered

Pro Arcade Expression using When

Question asked by mvolz47 on Apr 2, 2018
Latest reply on Apr 2, 2018 by Dan_Patterson

I am trying to calculate a field in Pro based off another field using the When function in Arcade.  The field I am calculating off (TYPE) is numeric with values such as 1,2,3,4.  The field I am calculating is text.


I use Calculate field and select Arcade for Expression Type and add the following text:


var type = $feature.TYPE;
When([type = 1, 'Primary', type = 2, 'Secondary', type = 3, 'Tertiary'], 'N/A')


Unfortunately, when I verify the expression I get the following error message

"Invalid Expression

Error 0 on line 2.

Close square brace expected."


I thought I was following the sample in the documentation, so I'm confused that I would get an error.


Any help to solve this issue is greatly appreciated.