Referencing a great grandparent case property


I have an app where I am registering a village, then have a child case of household, and within this have child cases for women, and then child cases for their children - so 4 generations of cases.

I want to refer to a case property from village cases in the form display logic for a child case, so that the form only shows after a certain date. I cannot figure out the syntax. I have tried (where fu_date is the name of the case property):

date(#parent/parent/parent/fu_date <=today())


date(#grandparent/fu_date <=today())

Where is the error?


Unfortunately I don’t think that the app builder’s shortcut for parent expressions is recursive in this part of the app builder so you’ll need to write out the query selectors manually

#parent/property is equivalent in the app builder to the query

instance(‘casedb’)/casedb/case[@case_id=instance(‘commcaresession’)/session/data/case_id]/index/parent]/property = ‘test’

so nesting that expression 2 more times (to get to a case’s Great Grandparent) would be equivalent to


making the final expression that you want (I think) the following:

date(instance(‘casedb’)/casedb/case[@case_id=instance(‘casedb’)/casedb/case[@case_id=instance(‘casedb’)/casedb/case[@case_id=instance(‘casedb’)/casedb/case[@case_id=instance(‘commcaresession’)/session/data/case_id]/index/parent]/index/parent]/index/parent]/fu_date) <=today()