Reusing/Assigning old variable for calculation

Hi ODK Community,

When writing an XLSForm, I'm aware that each variable is uniquely named in the "name" column. Does this mean that it is impossible to do a calculation and assign the result to an existing variable?

The repeat group does not meet all of the use cases we need for our survey. Luckily, the number of repeats in our survey are small; so now we have 'unrolled' the repeat loop into a series of repeated questions in the XLSForm. Since we are doing this, it would be helpful to reassign repeated calculations to a single variable, instead of a unique one every time we repeat the question.

Regards,
Dave

Hi Dave, I don't think the calculation works with repeat group, as on repeat group, every time you will add a field will not open up with a unique variable. From my experience, I could not make it happen with repeat group. You need to determine a maximum number of fields you need and that is only to do in a case of calculation.

Thanks,
Imran

And just to answer the narrow question of assigning a result to an existing value. You can send data forward in a form (e.g., in the next question's label) but you cannot send it backwards (e.g., into a previous question).

1 Like