Pulling value from different groups using Dynamic Data Attachment

I have a parent and child form linked using connect projects. It works as the support article specified.
The article only shows how to pull data with the instance function where the ID used in searching and the value to retrieve are within the same group.

In my case and in the parent form, I have group1, group2, and group3. group1 has the ID and group3 has a Date.

In the child form I use this: instance('survey')/root/data[group1/P_ID = current()/../C_ID]/group1/P_Name and it returns the name from the parent form.
But when I try to get the Date from group3 in the parent form, it does not work.
I tried all the below combinations without any results:

instance('survey')/root/data[group1/P_ID = current()/../C_ID]/Date
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/group3/Date
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../group3/Date
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../root/data/group3/Date
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../data/group3/Date

I even have a question in the parent form called “remarks” that is outside all groups and tried to get its value with:

instance('survey')/root/data[group1/P_ID = current()/../C_ID]/remarks
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../remarks
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../root/data/remarks
instance('survey')/root/data[group1/P_ID = current()/../C_ID]/../data/remarks

and did not work.
I am not familiar with these expressions and did not find any documentaion on how to use instance function and navigate different nodes/groups.

Thanks
Isslam

I figured out the issue just after submitting this post.

I was double-checking the info I provided was accurate and going through my forms I noticed that I was only sharing specific questions and did not share the “remarks” question. I did so, redeployed forms and the below worked:

instance('survey')/root/data[group1/P_ID = current()/../C_ID]/remarks

And for getting the date from group3, this also worked:

instance('survey')/root/data[group1/P_ID = current()/../C_ID]/group3/Date

Very happy after spending the whole day on this and I hope this post helps others with the same issue

3 Likes

@Isslam, :clap: :heart: :partying_face: