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
Hello there,
I have almost same issue here,
Menu and submenu whth no parent child relation, but I don't have case id value in the submenu instead, I have other case property which is Beneficiary_ID, which should be selected from the parent menu, accordingly, we should filter the submenu case list
you just need to consider which fields need to be filtered by which fields.
depending on which case list you are on, you can reference the "current case" properties by just using the property name in caselist filters.
the caselist filters run row by row, and assume that you are referring to the row currently being evaluated in your case list.
in Clayton's example
if(instance('locations')/locations/location[@id =
he is in the caselist filter for layer 2 if I understand correctly - it is generally a bit confusing when you're in that part of the system.
property_for_case_1_id is stored in the second layer's case.
instance('commcaresession')/session/data/case_id refers to the case that was selected in the parent menu.
so that code is saying "while I am in the second menu's case list, I want to check that the property from the second menu's case currently being avaluated has the same value as the case id of the case that I have selected on menu 1."
Many thanks for your reply, Mazen,
I did exactly same, but getting the error "Logic references instance(commcaresession)/session/data/Beneficiary_ID which is not a valid question or value."
the filter I added was like: Beneficiary_ID = instance('commcaresession')/session/data/Beneficiary_ID
where the Beneficiary_ID is the case property both in the case of the parent and submenu
where you put this filter matters in how you can access the information you wish to filter by.
for case_id is not the same as beneficiary ID. case id is a standard field in context that can always be referred to. beneficiary ID is something YOU added.