Select to view content in your preferred language

Need help with calculating fees with Survey123...using if statement maybe???

105
7
Jump to solution
Tuesday
jeffhyderBRVA
Emerging Contributor

I am trying to calculate a fee based on a entered amount and I have that field set to a integer type.

I am thinking possibly an if statement.

 

if(${estValueofWrk}<1000) then ${estValueofWrk} div 100) * 2 + 25) or if(${estValueofWrk}>=1000 and${estValueofWrk}<49,999 then  ${estValueofWrk} div 1000) * 5 + 50) or if(${estValueofWrk}>=50,000 and${estValueofWrk}<99,999 then  ${estValueofWrk} div 1000) * 4 + 250) or if(${estValueofWrk}>=100,000 and${estValueofWrk}<499,999 then  ${estValueofWrk} div 1000) * 3 + 450) or if(${estValueofWrk}<500,000 then  ${estValueofWrk} div 100) * 3 + 1500) or if (${estValueofWrk}>=16,166,666, then 50,000)

 

I am lost, thank you to anyone that can assist me in advance.

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor
if(${estValueofWrk} < 1000, (${estValueofWrk} div 100) * 2 + 25,
if(${estValueofWrk} >= 1000 and ${estValueofWrk} < 50000, (${estValueofWrk} div 1000) * 5 + 50,
if(${estValueofWrk} >= 50000 and ${estValueofWrk} < 100000, (${estValueofWrk} div 1000) * 4 + 250,
if(${estValueofWrk} >= 100000 and ${estValueofWrk} < 500000, (${estValueofWrk} div 1000) * 3 + 450,
if(${estValueofWrk} >= 500000 and ${estValueofWrk} < 16166666, (${estValueofWrk} div 100) * 3 + 1500,
if(${estValueofWrk} >= 16166666, 50000, 0))))))

View solution in original post

0 Kudos
7 Replies
DavidPike
MVP Frequent Contributor
if(${estValueofWrk} < 1000, (${estValueofWrk} div 100) * 2 + 25,
if(${estValueofWrk} >= 1000 and ${estValueofWrk} < 50000, (${estValueofWrk} div 1000) * 5 + 50,
if(${estValueofWrk} >= 50000 and ${estValueofWrk} < 100000, (${estValueofWrk} div 1000) * 4 + 250,
if(${estValueofWrk} >= 100000 and ${estValueofWrk} < 500000, (${estValueofWrk} div 1000) * 3 + 450,
if(${estValueofWrk} >= 500000 and ${estValueofWrk} < 16166666, (${estValueofWrk} div 100) * 3 + 1500,
if(${estValueofWrk} >= 16166666, 50000, 0))))))
0 Kudos
jeffhyderBRVA
Emerging Contributor

That worked perfectly, now how do I format it that it will return the value in $##,###?

0 Kudos
DavidPike
MVP Frequent Contributor

I'm not sure there is anything built-in to do it.  There's a way mentioned here 

https://community.esri.com/t5/arcgis-survey123-questions/in-survey-123-connect-is-there-a-way-to-for...

0 Kudos
jeffhyderBRVA
Emerging Contributor

Well after some testing it is not quite working perfectly. When I put in like 1,700,000 it is calculating 52500 if I put in 1,100,000 it calculates 34500. I currently have my set as a text maybe I should have it set as an integer?

0 Kudos
DavidPike
MVP Frequent Contributor

That seems to be correct values from the logic of the first question.  What are you expecting as the results?

(1,700,000 / 100) * 3 + 1500 = 52500

(1,100,000 / 100) * 3 + 1500 = 34500

0 Kudos
jeffhyderBRVA
Emerging Contributor

I got it figured out, one of the div was a 100 and not 1000 and it was throwing everything for a loop.

 

0 Kudos
ZachBodenner
MVP Regular Contributor

Take a look at this community thread: https://community.esri.com/t5/arcgis-survey123-questions/conditional-if-then-else-logic-in-survey123...

Survey123 doesn't use quite the language you'd expect. There's no "then" for example. Doug does a good job showing how an if statement could work here.

Happy mapping,
- Zach