Help needed - updating hidden value calculations in a repeat group

Hi All, I've come across a problem which I would really appreciate some help with.

I have a repeat group which includes a barcode scan (of a participant's barcode) and then a hidden value calculation which pulls information from a lookup table (e.g. name, date of birth etc) on this particular participant. The next question displays the output of the hidden value calculation and reports the name and DOB of that participant so that this information can be confirmed.

This works perfectly for the first participant but when I add a new repeat (i.e scan a new participant), the hidden value calculation does not seem to update and therefore the information it reports is from the previous participant, not this one. Does anyone know how I can adapt my form to ensure that the hidden value calculation updates every time a new repeat is started and a new barcode is scanned? It is important that this information is inside a repeat group because it will require an unknown number of iterations, so cannot just be a number of separate individual questions. I would be so grateful for any help!

Just to outline the structure of my form:

Repeat group
Barcode scan - {Participant barcode}
Hidden value - {participant name}
(instance('participants')/participant_list/participants[participant_barcode =
#form/repeat_group/participant barcode)]/participant_name
The participants name is: {participant name}. Is this correct?