Calculation works in Connect but not web version

443
3
Jump to solution
06-30-2022 08:38 AM
JKrob
by
New Contributor II

Hello,

I am working on a survey for a program where participants have an initial interview, then go through a series of check-in/follow-up sessions. After two sessions, they are eligible for an incentive voucher at each of the following sessions.

I have the session information set up in the survey as a repeat, where each session would be a new entry, and I’m trying to figure out a way to count the total number of vouchers given out over all the sessions. There is a relevant expression on the voucher question so that it doesn’t show up for the first two sessions, and I used a calculation coalesce(sum(${VoucherCount}),0) to get around the null values from that. It works in Connect but when I publish it to the web version, it doesn’t work anymore. If the repeat entries are all for sessions that have the voucher question, it works fine, but as soon as one of the repeat entries is for either session 1 or 2, the count of total number of vouchers given goes back to blank.

My guess to why it’s not working is because of a difference in how Connect and the web version interpret calculations, but I can’t figure out how to make it work. Any help would be much appreciated. The survey was designed in Connect and updated to version 3.15. I have attached a simplified version of the survey xls I made for testing the problem.

Thanks!

0 Kudos
2 Solutions

Accepted Solutions
DeonLengton
Esri Contributor

Hi @JKrob 

 

The issue seems to be with the relevant calculation for your voucher group. When I removed the relevant calculation it worked perfectly.

Perhaps try to use the body::esri:visible column to hide/show the group - I suspect that using the relevant setting it causes nulls in the voucher number field which causes the sum() to fail.

Hope that helps!

View solution in original post

0 Kudos
JKrob
by
New Contributor II

Hello!

Finally got around to figuring this out. Like @DeonLengton suggested, using the body::esri:visible column instead of the relevant column for the voucher group was the key, but I also had to set the default value of the count question to 0. Now there is no chance of a null to mess up the calculation and it works as expected in both Connect and the web version.

I’ve attached the fixed simplified xls in case anyone wants to see my final solution.

(Thank you again @DeonLengton for your help!)

View solution in original post

0 Kudos
3 Replies
DeonLengton
Esri Contributor

Hi @JKrob 

 

The issue seems to be with the relevant calculation for your voucher group. When I removed the relevant calculation it worked perfectly.

Perhaps try to use the body::esri:visible column to hide/show the group - I suspect that using the relevant setting it causes nulls in the voucher number field which causes the sum() to fail.

Hope that helps!

0 Kudos
JKrob
by
New Contributor II

Hi @DeonLengton,

Thank you for the suggestion. I didn’t even know that the body::esri:visible column was there, so that was good to learn. Unfortunately, it did not fix the problem of the total voucher calculation not working in the web version. I agree with you that it’s probably the relevant causing a null making the sum() fail. I could remove the relevant expression completely as a last option, but I would rather keep it in for better usability. Do you have any other ideas for how to make the calculation work?

Thanks!

0 Kudos
JKrob
by
New Contributor II

Hello!

Finally got around to figuring this out. Like @DeonLengton suggested, using the body::esri:visible column instead of the relevant column for the voucher group was the key, but I also had to set the default value of the count question to 0. Now there is no chance of a null to mess up the calculation and it works as expected in both Connect and the web version.

I’ve attached the fixed simplified xls in case anyone wants to see my final solution.

(Thank you again @DeonLengton for your help!)

0 Kudos