I need help on how to Prefill the respondent's name as the first Household name in a repeat group. I want to record the respondent's name at the beginning of an odk questionnaire; and pre-record the respondent's name as the first name of the Household in a repeat group.
If you wish to only display the respondant's name as the first name in the repeat group - that is, the user can not change it - then you can do so using suitable show/hide logic on a read-only note.
However, I assume what you are asking is that you want to pre-fill a default value for (just) the first name in the repeat group, with the name of the respondant (correct?). In that case, try this:
The 'secret sauce' here is adding a calculation on the text input question:
once(if(position(..)=1, ${respondant}, ''))
Because it has a calculation, it will get re-evaluated continuously as you fill in the form. However, as a consequence of using once() the calculation will only update the result ${name} when ${name} is null/empty. And when it is null, which will be the case when you first start up the form, and it is the first entry in the repeat group (ie position(..)=1) then it will fetch the value of ${respondant} if it has one. Otherwise - or if you havent answered the respondant question yet - it will return null again, causing the calculation to continue to be re-evaluated until the ${name} question is answered, or in the case of the first entry you give a value to ${respondant}.
Note, a 'limitation' of this solution is that if you go back later and change the value of ${respondant}, its new value will not get picked up by the name in the first entry; because it already has a value, the once() effectively means the calculation doesn't fire again [but then that's arguably the definition of a 'default'... ]
Note, this may be used as a general approach to prefilling dynamic defaults from previous responses, not just for within repeat groups.