Dynamic data attachments - retrieve latest submission for given ID

I am trying to set up dynamic data attachments in kobo toolbox.

My parent form is ‘RW SQ Kobo live’. My child form is ‘RW SQ Updates kobo draft - short version’.

The aim is to pull the value of each item_ variable from the parent to the child form. The parent form will have multiple submissions for the same centre, so the child must pull the value from the latest submission for the selected centre.

Each centre has a unique ID value shown in the choices tab (e.g. bug01). I’ve attempted to use the following formula to retrieve the latest item_1 value from the parent form for the centre ID value. It currently appears as blank when I test it for a centre that I know has a parent form submission. What’s the correct formula to use?

instance(‘rw_sq_parent’)/root/context[centre = current()/context/centre][last()]/item_1

Attaching a screenshot of the child form settings but I don’t have permission to upload the forms as attachments.

Welcome to the community, @bop! This support article should help you solve your issue:

Hi Kalyan, thanks for your response. Could you please share the formula I should use? I saw the article you shared already and couldn’t see anything addressing what I’m trying to do specifically.

Hi @Kal_Lam are you able to help on this? If not, I won’t be able to create the functionality we need. Thanks!