Autocalculation not working in Web survey123

302
3
01-25-2022 07:38 AM
chelynnes
New Contributor III

chelynnes_0-1643125078195.png

Why are these calculations working in connect and field app, but not webform?

0 Kudos
3 Replies
chelynnes
New Contributor III

Field app :chelynnes_0-1643127564259.png

Web : 

chelynnes_1-1643127817766.png

Ok, so the calculations are doing something,.. but theyre not being read the same in the web and field app?

0 Kudos
IsmaelChivite
Esri Notable Contributor

The Survey123 web app is very particular about dates as it only works with decimal-dates.

More details here: https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

Looking at your expression, it looks as if you are mixing decimal dates and unix dates. Connect handles it, but the web app gets a different result because it expects you to always use decimal date.

The table below shows the differences with other examples. Both columns will work in Connect and the field app, but only the column on the right will work in the web. Note how decimal-date-time() is used consistently to handle dates in expressions.

 

 

 UNIX timeDecimal Date time
2 weeks into the futurenow() + 14*24*60*60*1000date(decimal-date-time(now()) +  14)
Calculate age from birthdayint((today() - ${birth_date}) div (1000*24*60*60* 365.25))

int((decimal-date-time(today()) - decimal-date-time(${birth_date})) div 365.25)

Minutes spent for lunchint(${LunchEnd} - ${LunchStart}) div (1000*60)

int((decimal-date-time(${lunchends}) - decimal-date-time(${lunchstarts})) * 24*60)

15 minutes from nownow() + 15*60*1000

date-time(decimal-date-time(now()) +  0.0104166675)

0 Kudos
chelynnes
New Contributor III
I've seen this chart, but I'll have to do more testing on the formula.
0 Kudos