Problem with the calculate function in a repeat

766
4
Jump to solution
12-13-2019 02:06 PM
FlorenceRaimbault
New Contributor III

I have a survey with a repeat. In the survey I have a question to know if the survey is cancelled or not. I need to report that information in every repeat. I try a calculate in the repeat to copy the information. But only the first repeat contains the value of the calculate.

I have the same problem with another calculate field (sum) in the repeat the field contains the result of the concatenation of 2 fields from the main survey.

 

Is there a way to calculate the value for each repeat?

this is the result of the 4 repeats in the same survey.

error calculate reapeat

I joint my xls form

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Florence,

There is no way to update the values in the repeat section with updated values from the parent if the value changes and the repeat already had values. This would cause changes to existing data that if were not wanted, would not be able to be undone. This is why the recalculation button must be pressed to update the values.

Phil.

View solution in original post

0 Kudos
4 Replies
by Anonymous User
Not applicable

Hi Florence,

I had a look at your xlsx form and the issues you are seeing are due to the way you are using the calculate fields in the repeat. The calculate question type is a hidden field in the form, this means it can only be updated once and if the values for the inputs are changed, you can not recalculate the expression.

If you change the calculate questions to text questions for testing, the behaviour will be exactly the same but they will be visible in Connect/app so you can see what is happening.

I am seeing the concat calculation working as expected, provided both info1 and info2 have values at the time of navigating between the repeats. If you modify or add values to those fields after you have navigated between repeats, you would need to recalculate the sum, which you can not do for hidden calculation question types.

The same applies for the annuler_collecte question, you have set a default of non, so if the repeat is navigated when the answer is non, all the repeats will have this value. You need to change this value in the select one before the repeats are updated. I would suggest moving this question above the repeat section not after it.

Phil.

0 Kudos
FlorenceRaimbault
New Contributor III

Thanks, Phillip, for the explanation.

I understand that my way to transfer the information from the parent form to the repeat (child) doesn’t work very well when we update the parent.

My problem is that we use only the repeat layer in a webapp to show the result of the survey, and we would like to show the parent info in the same layer without a joint.

 

So Is there à way to transfer the information from the parent form to all the chill using a hidden way, when I update the parent form without to have to update all the child individually?

0 Kudos
by Anonymous User
Not applicable

Hi Florence,

There is no way to update the values in the repeat section with updated values from the parent if the value changes and the repeat already had values. This would cause changes to existing data that if were not wanted, would not be able to be undone. This is why the recalculation button must be pressed to update the values.

Phil.

0 Kudos
FlorenceRaimbault
New Contributor III

Thanks Phillips for your explanation. I will need to change my process using a joint between the child and the parent for my webapp.