I have a multi-condition formula that has always worked previously and is no longer working. I am not sure why? It seems fine until I try to close the formula with an "end" or "endif".
If [Hospital Beds] <= 25 then '1-25 beds' elseif [Hospital Beds] >= 26 and [Hospital Beds] <= 99 then '26-99 beds' elseif [Hospital Beds]>= 100 and [Hospital Beds]<= 299 then '100-299 beds' elseif [Hospital Beds]>=300 then '300+ beds' else ' ' endif
Solved! Go to Solution.
@aberthiaume The error is happening before a run or in runtime?
I tried creating the same situation on my machine and it worked.
Just, check the space after >= 300 and check if [Hospital Beds] is a numeric field.
Thank you for your response. The "Hospital Beds" Field is a V_W String. This is the error and this is the error I also get within the workflow. This error pops up regardless of run.
@aberthiaume You can try using the function to ToNumber to convert String to the number and then be able to compare using operators >. >=,
If ToNumber([Hospital Beds]) <= 25 then '1-25 beds' elseif ToNumber([Hospital Beds]) >= 26 and ToNumber([Hospital Beds]) <= 99 then '26-99 beds' elseif ToNumber([Hospital Beds]) >= 100 and ToNumber([Hospital Beds]) <= 299 then '100-299 beds' elseif ToNumber([Hospital Beds]) >= 300 then '300+ beds' else ' ' endif
Or you can try to use a select tool before the formula and change the datatype.
That makes sense. I will try that! Thank you!