Case Linking (Parent/ChildCases)

70 views
Skip to first unread message

Moses Katembu

unread,
May 21, 2015, 6:05:00 AM5/21/15
to commcar...@googlegroups.com, Kai Cowger
Dear All,

We already have Parent/Child Case features in our application and we would like to expose/load the parent case_id to child cases when doing registration or we would like to have the parent case_id data-node appear on child case exports as parent_id.
Has anyone faced this scenario and how did you implement it?
Is this already build in Commcare case exports for Child Cases? 


--
Regards,
Moses

github: katembu
twitter: mkatembu
skype: katembu

Sheel Shah

unread,
May 22, 2015, 5:01:46 AM5/22/15
to commcar...@googlegroups.com, Kai Cowger
Hi Moses,

Unfortunately that isn't easily possible - when you do an export, you'll actually get two tables.  The first one lists all the child cases, and the other one maps the child cases to their parent case IDs.  Its a bit clunky - feel free to post on our Uservoice about how to make it better (dimagi.uservoice.com). 

In your forms, in the case config section, you can also try loading parent/@case_id or index/parent (i'm not sure either will work but worth trying). 

Thanks,
Sheel
--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Sheel Shah
Project Manager | Dimagi
m: +1.781.428.5419 | skype: sheel_shah



Eric Stephan

unread,
May 22, 2015, 5:34:04 AM5/22/15
to commcar...@googlegroups.com, kaic...@gmail.com

Hey Sheel -- I am sure I am misunderstanding this thread... but when I read Moses's words, "expose/load the parent case_id to child cases when doing registration," is that not that different from the technique you showed me, where, when a form creates a child case, you can simply pass the parent form's case_id to the child simply by means of the case management field?

That seems too easy, there must be something I'm misunderstanding.

Eric

Kai Cowger

unread,
May 22, 2015, 5:56:56 AM5/22/15
to commcar...@googlegroups.com, kaic...@gmail.com
Hi Eric-

Thanks for the reply.  I hope I am getting you correctly: are you basically just saying to add parent_id to the case management field properties during child registration?  If so, it is a good idea, and would work for only prospective registrations, correct?  How about all the retrospective children, ie those who have been registered in the past.  When we export the case list, they will not have the parent_id attached to them will they?

Thanks again-

Eric Stephan

unread,
May 22, 2015, 6:25:08 AM5/22/15
to commcar...@googlegroups.com

Hi there -- I'm running out of the office right now, and wanted to make a quick reply for now. (Also, not certain I can speak clearly to your questions so it's maybe better for Sheel to reply and point out that I am totally misunderstanding you guys.)

But just for a summary of what I did for my own "wanting to pass the owner_id to a child case so that it would have the same owner as the case that created it," ... please see the answer that Jeremy gave to my thread here:  https://groups.google.com/forum/#!topic/commcare-users/awKPmRp80g8

Eric 

Moses Katembu

unread,
May 22, 2015, 1:13:06 PM5/22/15
to commcar...@googlegroups.com
Hi Sheel,

Thank you for your response. I had tried the two method you've suggested and none seemed worked. Just retested again to affirm this.
Also I haven't found a common data_node to link the two tables. Would you mind sharing the data_node that link cases between the two tables.

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kai Cowger

unread,
May 26, 2015, 10:23:21 AM5/26/15
to commcar...@googlegroups.com
Just to add to the discussion, another way to link the parent case to the child case is to include "Parent Case" in the custom child exports (selecting row.number and case_id and case_type if you want).  I linked the row.number from the child cases excel sheet to the row.number from the parent case excel sheet, and you will have the child case_id with the parent case_id. 

Sheel Shah

unread,
May 26, 2015, 6:30:12 PM5/26/15
to commcar...@googlegroups.com
Thanks for the update Kai - I think that's the only way (for now) to get a data export linking parent and child cases.  Moses, I would put your other suggestions on our Uservoice (dimagi.uservoice.com). 

Thanks,
Sheel
Reply all
Reply to author
Forward
0 new messages