Hello - I am attempting to write what should be simple arcade code, but I just don't have the experience. I know how I'd write it in Python, but Arcade is throwing me.
My first two statements work fine. But I need an option for when these two fields are BOTH == 'Yes', the code returns 'OHG Slack Span'. Any help will be greatly appreciated!
if ($feature["Overhead_Guy"] == 'Yes'){
return 'OHG'
}
if ($feature["Slack_Span"] == 'Yes'){
return 'Slack Span'
}
I found a technical support page Use multiple conditions that makes the answer seem obvious but putting the || between my conditions is throwing the 'unexpected token ||' error
Thanks!
Solved! Go to Solution.
Don't use a return in each of the if statements, but use a variable. Putting a space after the OHG in the first statement makes it ready for the next statement, but it will get trimmed away if not needed in the return.
var output = '';
if ($feature["Overhead_Guy"] == 'Yes'){
output = 'OHG ';
}
if ($feature["Slack_Span"] == 'Yes'){
output += 'Slack Span'
}
return Trim(output);
Don't use a return in each of the if statements, but use a variable. Putting a space after the OHG in the first statement makes it ready for the next statement, but it will get trimmed away if not needed in the return.
var output = '';
if ($feature["Overhead_Guy"] == 'Yes'){
output = 'OHG ';
}
if ($feature["Slack_Span"] == 'Yes'){
output += 'Slack Span'
}
return Trim(output);
That worked first try! Thank you so much!
Glad to help. Don't forget to click the "Accept as Solution" button