You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »


These calculations are advanced, and require complex expressions.

Count of all Child Cases

You may want to get a count of all the open child cases that a specific parent case has. The expression you should use is: 

In a form: 

count(instance('casedb')/casedb/case[index/parent = instance('commcaresession')/session/data/case_id][@status = 'open']) 
In a form display condition: 
count(instance('casedb')/casedb/case[index/parent = @case_id][@status = 'open'])

Displaying Only Parents with Child Cases

In a case list, if you'd like to filter the case list to only show parents that have open child cases, use the following expression: 

count(instance('casedb')/casedb/case[index/parent = @case_id][@status = 'open']) >= 1

Note: both of these expressions will only work if the both parent and all child cases are owned by the mobile worker that is in use.
  • No labels