Accessing selected Case ID in Case List from sub menu with Advanced Modules


I have the following menu structure:

  • Standard Module 1 (case_type_1)
    • Advanced Module 2 (case_type_2)

One of the properties of case_type_2 is an ID of case_type_1. There is no parent/child relationship between these case types.

I can’t find the xpath expression that would allow me to filter the case list in Module 2 based on the case_id of the case selected in Module 1.

Could you help me figure out what would be the correct xpath, if this is possible?



Hi Guillaume,

I think that the expression you want is

property_for_case_1_id = instance(‘commcaresession’)/session/data/case_id

which I believe should filter the list of case_type_2 cases based on the selection from the first case list.


Hi Clayton,

Thanks for your answer. I had tried this before and it didn’t work. I was really puzzled since I had seen that answer in many places in the forum and on the wiki. It turns out it was a copy/paste issue with the single quotes… My zen was tested again.


Ah, right, sorry. Discourse annoyingly automatically replaces the ASCII single quote with unicode fancy quotes, which wreaks havoc on copying and pasting some expressions.

I found a setting in discourse that claims to disable this behavior so that we won't have similar issues. Added some tests below

instance('casedb')/casedb/case[testvalue = "one"]

1 Like