Calculation does not work in Web App

183
1
05-22-2023 09:42 AM
Hammers211
New Contributor III

Hello!

I have a series of calculations that work in connect and the field app, but not in the web app. Here is part of the series:

if(selected(${Number_Employees}, '0-5'),5,0) or
if(selected(${Number_Employees}, '6-10'),5,0) or
if(selected(${Number_Employees}, '201+'),5,0) or
if(selected(${Number_Employees}, '11-50'),0,0) or
if(selected(${Number_Employees}, '51-200'),0,0)

From doing some digging, I think the issue may be that I'm using the "or" operator, which returns a boolean value. Am I correct on that? If so, do I need to figure out how to nest the above calculation such that there is no "or"? Thank you in advance!

0 Kudos
1 Reply
JenniferAcunto
Esri Regular Contributor

If statements have three parts, the statement it is evaluating, what to do if the statement is true, and what to do if the statement is false. When chaining if statements, 'what to do if the statement is false' needs to be 'continue to the next if statement'. Your final if statement will then have the default value if all of your statements are false.

if(selected(${Number_Employees}, '0-5'), 5, 
if(selected(${Number_Employees}, '6-10'), 5, 
if(selected(${Number_Employees}, '201+'), 5, 
if(selected(${Number_Employees}, '11-50'), 0, 
if(selected(${Number_Employees}, '51-200'), 0, 0)))))

 

- Jen
0 Kudos