Default Values Do Not Populate or Transfer when there is a Relevant Expression

03-17-2022 06:25 PM
New Contributor III

When populating a Survey the fields with Default values AND 'exclusive' Relevant expressions do NOT populate or transfer when surveys are submitted.  The issue relates to BUG-000115589 raised in 2017 and modified in 2021 but not resolved.

So essentially what happens is any data that is NOT relevant is excluded even though default.  In my case I have multiple Boolean questions using 'esriFieldTypeSmallInteger'. If the question is NOT relevant I still need it to parse a '0' on survey submit in the JSON that is uploaded to the server. Otherwise you are left wondering if the answer was 0 or 1 or did something go wrong in the survey or data transfer process. In my case I now have to look through hundreds of surveys and photos individually and make/verify decisions for at least 10 fields and hundreds of row records.

I am looking for a some type of logic implementation that may help me circumvent the issue in the future and override the surveys' decision to exclude the data on transfer.  While the answers may prepopulate the entire survey on initiation, the use of relevant fields then 'cleans' out the default values leaving a blank.

Running my own bug resolution tests in Survey 123 Connect clearly shows the JSON to be uploaded is missing answers to those 'irrelevant' questions entirely.  While that may seem logical to not include data, it is also logical to have a default 0 value so I know a decision has been made and the answer populated. That way I am not left guessing if there was some other issue occurring in the survey.

The sort of solution I need here is one that does not come with logic complications that must then be resolved with more logic to solve a simple request.

Things I have tried;

1. set bind::esri:parameters to 'auto' but that did not work

2. applying calculation logic to check if the field had ben cleared back to '' based on the radio button event removing the default value of '0'.  Problem was I didn't get the right logic happening. And it is usually important to have an event to make a calculation occur.  I have not totally given up on this approach though.

3. removing 'relevant' expressions from the Group Begin (which was important as it was designed and required to ensure surveyors are not looking at and or getting confused with irrelevant selection options).

This ONLY worked for fields that had NO subsequent relevant expressions.  It did not work for any other fields which had default values of 0.

4. removing Relevant expressions altogether... my current thoughts here

Maybe an alternate approach is to NOT use the issue causing 'relevant' column.

I will have an attempt at triggering an event that simple 'hides' the field on the form but does not 'remove' it from the data.  Any ideas on this approach would be welcomed.

Thankyou for your time.





0 Kudos
5 Replies
New Contributor III

Solved for the moment until I work through the rest of the logic and questions

This post here gave the example of what I was after hide-a-question-and-populate-it-with-a default value 

I simply moved the Relevant logic to the 'body::esri:visible' column and now all my default values are appearing in the JSON test exports from S123 Connect.

0 Kudos
New Contributor III

While the problem has been solved for singular questions, a problem still exists for 2 part dependent boolean logic questions.

I have resorted to also using calculations in combination with 'body::esri:visible' column as a complete replacement for 'relevant' 

The issue is that when you have a boolean question 1/0 using radio buttons, that relates to a subsequent question, even using calculations can result in the wrong data being stored; eg if you change your mind too many times it gets confused and the event does not keep firing.

eg correct possible logic

"Bore_Flowing": 0, and "Bore_OpenDrain": 0,

"Bore_Flowing": 1, and "Bore_OpenDrain": 0,

"Bore_Flowing": 1, and "Bore_OpenDrain": 1,

Incorrect Logic

"Bore_Flowing": 0, and "Bore_OpenDrain": 1,

The calculation I am using looks like this and for the most part this calculation logic works (unless a person changes their decisions back and forth)

So to overcome this final hurdle I have tried different combinations of calculations, but keep breaking the logic parser


if(selected($Bore_Flowing,'0'),0,1) and selected($Bore_OpenDrain,'1'),0,1)

2. if(selected($Bore_Flowing,0),int(($Bore_OpenDrain,0),if(selected($Bore_Flowing,1),int($Bore_OpenDrain1),0))


if(selected($Bore_Flowing, 1),1, if(selected($Bore_OpenDrain, 0),0,1))

I am running the calculation to fire in the dependent field (ie the 2nd ?  "$Bore_OpenDrain")

Any ideas on what may be the best solution here or logic modifications to fix the broken parser?

0 Kudos
MVP Esteemed Contributor

I was posting the visible column and see you got it. 

Are these note fields?  I have found the calculate type updates better but then of course you cannot see it.  Notes seem a bit slow.  In the past I tried you trick above as well but to another field like one in a repeat which can force it to update.  It is looking for a change before it will fire.

You could try the new calculation modes and force it to recalc all the time.  I have had some luck with this.  Note must use the new 3.14 

Hope that helps

0 Kudos
New Contributor III

Hello Doug

Thankyou for your time

I am using calculations and have set their esri parameters to 'auto' or 'always' recalculate but something is still not right.  The logic implemented "if(selected(${Bore_Flowing},'0'),0,1)" works fine right up until you change the answer in question 2 to 1 and the answer to question 1 to 0.

Scenarios that are valid: 

Q1 = 1 and Q2 = 0       

Q1 = 0 and Q2 = 0       


Q1 = 0 and Q2 = 1        (because if there is no water flowing   how can it go into a drain)

The problem arises when I have Q2 selected as 1, and then change Q1 back to 0 

The calculation does not trigger Q2 to change its value back to 0

When Q1 is changed to 0, Q2 becomes hidden, but keeps its value of 1

This becomes a problem when users in the field change their mind, or have accidentally made the wrong selection because of glare from the tablet etc.  

As soon as you change Q1 to 0, then Q2 disappears so field users will not know that it has not reset to the valid value of 0.

In all cases the selection of Q1 = 0 needs to Trigger Q2 to reset to 0 even though it is hidden

I tried to join two selection calculations to achieve this using the 'and' to join them but that also failed

if(selected(${Bore_Flowing},'0'),0,1) and if(selected(${Bore_OpenDrain},'1'),0,1) (this breaks the parser)

It should also be noted I have no calculations running against Q1, which may be useful to 'reset' Q2 back to 0.   


0 Kudos
New Contributor III

I have simplified the complete problem into a 2 question survey

I have tested an array of syntax and logic and simplified it as much as possible but nothing seems to work
I have set the 'bind::esri:parameters' to AUTO but even it stops working

All calculations that parse eventually fail when the user changes Q1 to Yes and Q2 to No, then Q2 to No and finally Q1 back to No
Q2 JSON will always yield 1 which is invalid. "If the Tap is NOT ON, Water cannot Flow"

The calculations only work for so long before they fail.
It is for this reason I only see a javascript solution
Considering the complexity of some JS examples this issue should not be too complex for someone that understands esri's implementation of JS and referencing of controls and controlling execution order



if(selected(${TapOn}, '0'), '0', '0')
if(selected(${TapOn}, '0'), '0', '')
if(selected(${TapOn}, '1'), 0, '')

if(string-length(${TapOn})>0,'1', '0')

These Do Not PARSE

if(selected(${TapOn}, '0') and selected(${TapFlowing}, '1'), 0, 1)
if(selected(${TapOn}, '0') and selected(${TapFlowing}, '1'), '0', '1')
if(selected(${TapOn}, 0) and selected(${TapFlowing}, 1), '0', '1')


if(${TapOn}=0,and ${TapFlowing}=1),"0")
if(${TapOn}=0,and ${TapFlowing}=1),'0')
if(${TapOn}=0,and ${TapFlowing}=1),0)

if(${TapOn}='0',and ${TapFlowing}='1'),0)
if(${TapOn}='0',and ${TapFlowing}='1'),'0')

if(selected(${TapOn}, '0'), '0')
if(selected(${TapOn}, 0), '0')
if(selected(${TapOn}, '0'), 0)
if(selected(${TapOn}, 0), 0)

if(${TapOn}= '0'), 1, 0)
if(${TapOn}= 0), 1, 0)
if(${TapOn}= 0), '1', '0')


Hopefully someone knows how to get this working!


0 Kudos