Survey working in field app but not web app

393
8
Jump to solution
11-29-2021 12:45 PM
PrachiPatel
New Contributor III

I have created a survey in Connect. All calculations are working when survey is submitted via field app but many questions with calculations are not sending value to the hosted layer when survey is submitted via web form. Is there a way to submit survey from the web form and still have the fields populate as programmed in the calculation?

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

@PrachiPatel  @DougBrowning  This looks like a fundamental inconsistency on how null values are treated.

Take this XLSForm as a simplification of @PrachiPatel 's original expression.

IsmaelChivite_0-1638306605865.png

I added the calculation formula also in the hint column, so we can see what expression is being evaluated (Survey123 will replace the variables in the hint with their values).

As seen below, when the value in a2 is cleared, the expression changes to coalesce(10*,0) instead of coalesce(10*10). This works well and as designed in both apps. However, when the expression is evaluated the output is different.

NullValues.gif

This definitively will need more research from our side. One way or another, I would expect the output to be the same in both apps.

I think that you did well adding coalesce(), but you did not do it all the way. If you use this approach to the expression, the behavior will be consistent in both apps:

coalesce(${a1},0)*coalesce(${a2},0) + coalesce(${a3},0)*coalesce(${a4},0)

View solution in original post

8 Replies
IsmaelChivite
Esri Notable Contributor

Hi.  The Survye123 web app interprets XLSForm expressions more strictly than Survey123 Connect and the field app. There are for example some differences in how date-time expressions are handled and also how pulldata() functions can be used. What is the specific expression that is not working for you?

0 Kudos
PrachiPatel
New Contributor III

Hi @IsmaelChivite , There are too many questions whose calculations are not working. One example is below -

 (coalesce(${HOS_EMP}*${HOS_DOC},0) + coalesce(${OFF_EMP}*${OFF_DOC},0) + coalesce( ${RET_EMP}*${RET_DOC},0) + coalesce(${EAD_EMP}*${EAD_DOC},0) + coalesce(${MED_EMP}*${MED_DOC},0) + coalesce(${GRC_EMP}*${GRC_DOC},0) + coalesce(${ASL_EMP}*${ASL_DOC},0) + coalesce(${WAST_EMP}*${WAST_DOC},0) + coalesce(${LODG_EMP}*${LODG_DOC},0) + coalesce(${EDU_EMP}*${EDU_DOC},0) + coalesce(${MLI_EMP}*${MLI_DOC},0) + coalesce(${PAS_EMP} * ${PAS_DOC},0) + coalesce(${AUTO_EMP}*${AUTO_DOC},0) + coalesce(${PSER_EMP}*${PSER_DOC},0) + coalesce(${LAS_EMP}*${LAS_DOC},0) + coalesce(${CAR_EMP}*${CAR_DOC},0) + coalesce(${OTH_EMP}*${OTH_DOC},0)) div ${TOT_EMP}

All the fields referenced in this calculation have relevance expressions, which is why I have used coalesce.

 

0 Kudos
PrachiPatel
New Contributor III

My apologies, @IsmaelChivite , the calculations work in the field app, but this field with the calculation above is turning up blank when I submit the survey from the web form.

0 Kudos
DougBrowning
MVP Notable Contributor

Do you have the bind:type column set to int or decimal?

0 Kudos
PrachiPatel
New Contributor III

@DougBrowning the bind type is set to int for the field with calc shared above, but there are others that have bind type set as decimal - some work and some dont.

0 Kudos
IsmaelChivite
Esri Notable Contributor

@PrachiPatel  @DougBrowning  This looks like a fundamental inconsistency on how null values are treated.

Take this XLSForm as a simplification of @PrachiPatel 's original expression.

IsmaelChivite_0-1638306605865.png

I added the calculation formula also in the hint column, so we can see what expression is being evaluated (Survey123 will replace the variables in the hint with their values).

As seen below, when the value in a2 is cleared, the expression changes to coalesce(10*,0) instead of coalesce(10*10). This works well and as designed in both apps. However, when the expression is evaluated the output is different.

NullValues.gif

This definitively will need more research from our side. One way or another, I would expect the output to be the same in both apps.

I think that you did well adding coalesce(), but you did not do it all the way. If you use this approach to the expression, the behavior will be consistent in both apps:

coalesce(${a1},0)*coalesce(${a2},0) + coalesce(${a3},0)*coalesce(${a4},0)

PrachiPatel
New Contributor III

I am going to work on this suggestion and circle back!

0 Kudos
PrachiPatel
New Contributor III

It worked!

0 Kudos