API is called even when the question is NOT relevant

1382
5
Jump to solution
05-12-2021 03:06 AM
zkovacs
Occasional Contributor III

Hi all,

I have a number of Survey123 forms that use the what3words API to get the w3w address based on the current GPS location using pulldata@. This works as expected and I get the address just fine.

The field storing the w3w address is only relevant if a condition is true. I also have an if() statement set on this field for the calculation to only call the API is the same condition is true. However, it seems that the API is called regardless of my previous condition, and I suspect that it's because the calculation is evaluated automatically when the form is loaded. (I can see the number of API hits going up every time the form is loaded, I don't even have to get to my relevant field for the API to be called.) Can someone confirm this, maybe from Survey123 team?

I'm tagging you @JamesTedrick and @IsmaelChivite in case you have an answer to this. Thank you.

1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Zoltan,

There appears to be an issue with note questions triggering their calculations when not relevant (in your form, you are using read-only text questions; these are identical to note questions in behavior when published). 

This can be worked around by moving the calculation to a 'calculate' question that has the relevant condition and then use a 'note' question that echos the results of the calculate; see the attached sample for an example.

While I've noted this for the Survey123 team to look at, it would be helpful if you could file an issue with Esri Support.

View solution in original post

5 Replies
IsmaelChivite
Esri Notable Contributor

Hi Zoltan. If you can send a simplified version of the form that would be great.

zkovacs
Occasional Contributor III

Thanks Ismael, I've sent you a PM.

zkovacs
Occasional Contributor III

Hi Ismael,

Did you receive my messages? If you could let me know either way that would be great, thanks.

Zoltan

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Zoltan,

There appears to be an issue with note questions triggering their calculations when not relevant (in your form, you are using read-only text questions; these are identical to note questions in behavior when published). 

This can be worked around by moving the calculation to a 'calculate' question that has the relevant condition and then use a 'note' question that echos the results of the calculate; see the attached sample for an example.

While I've noted this for the Survey123 team to look at, it would be helpful if you could file an issue with Esri Support.

zkovacs
Occasional Contributor III

Hi James,

Many thanks for looking into this, I really appreciate it! I will raise a support call when I'm back from leave (or I'll ask my colleagues to do so in the meantime).

0 Kudos