Select to view content in your preferred language

Error Initializing Form

347
1
04-16-2020 03:46 PM
NEidenAZ
Occasional Contributor

When I try access the survey url in a web application I get an error.  The survey uses data from an existing feature service; data from this feature service is used in calculations when the form opens. 

The calculations come from a nested if statement which work in S123 Connect, but throw an error when opened in the web app.  

if(${CurrentCapacity}>${Capacity_Total}, 'Over Capacity', if(${CurrentCapacity}=${Capacity_Total}, 'At Capacity', if(${CurrentCapacity}<${Capacity_Total}, 'Under Capacity')))

Here's the error from the dev tools console: 

And the error itself:

Any ideas out there on what's going on? It works perfect in S123 Connect:

#Thanks!

~Nikki 

James Tedrick

0 Kudos
1 Reply
Jim-Moore
Esri Regular Contributor

Hi Nicole

Looking at your IF statement and the last line of the error message, it looks like the false argument is missing from the final nested IF statement (i.e. the value to return if all arguments are false). IF statements require three arguments: if(condition, value if true, value if false). So your calculation could look like:

if(${CurrentCapacity}>${Capacity_Total}, 'Over Capacity', if(${CurrentCapacity}=${Capacity_Total}, 'At Capacity', if(${CurrentCapacity}<${Capacity_Total}, 'Under Capacity','No capacity entered')))

If you want to return null instead, use '' in place of 'No capacity entered'.

Hope this helps!

Best,

Jim

0 Kudos