Count Case List Number

Hi All,

Is it possible to count the total number of case list ?

i want to count the total number of cases showing in case list of a mobile worker.

Thanks in advance.

Hi,

Where do you want that count to appear?

If you are curious for an individual case list, I think if you search the list you will get a results string like "Showing 2 of 323 matching 'your search'," but unfortunately I don't think there's currently an easy way to display the result more pervasively.

-Clayton

Hi Clayton.... Thanks for your reply.... search is not a solution what i am looking for.... i want to display total number of case list against a mobile worker into case details or somewhere else.

this is required for our project and i hope there might be some way to get this,

hi Khan

your request isn't really very clear.

you CAN count cases that appear in a caselist theoretically. you just count(casedb object with the parameters you're looking for) but things can get really misleading, and really confusing depending on your mobile worker setup and what that caselist is searching for.

if you store the mobile workers names against cases you're trying to count, then it's probably possible. however, where are you going to store that value? moreover, where are you going to see it?

if you say "in the caselist" i'll say to you, what type of cases? is it the type of cases you're trying to count? if so, then not really much use for that here. if not, then maybe you can.

Question: what type of cases should you be looking at in the app in order to find out how many other cases that each mobile worker has created? see what i mean here? you wish to link different kinds of objects together and that's not always possible.

i suggest looking at something called "user cases" and perhaps update a number property there whenever a mobile worker creates a case. this is the easier and most straight forward way i can think of at the moment. however, it demands that the cases a user can see are cases that they themselves have created. otherwise, things can get very complicated with no guarantees to get the result you're after.

there's always the option of using hidden calculations or calculated case list properties. but, that really depends on what you're using to assign cases to mobile worker and how the mobile workers are set up.

HTH

Hi Mazz

Let me explain.....

A mobile worker visits a village and register a Child death as a case if it happens there. That child death case appears in Mobile worker Case list. Mobile worker visits and register Child death if it happens again in his/her village thus in the case list , Child death shows as a case list.

Now i want to count the number of cases (Child Death) showing in Case list of mobile worker and want to display that count in Case details/case list.

Thanks for your help in advance.

Let me explain…

A mobile worker visits a village and register a Child death as a case if it happens there. That child death case appears in Mobile worker Case list. Mobile worker visits and register Child death if it happens again in his/her village thus in the case list , Child death shows as a case list.

Now i want to count the number of cases (Child Death) showing in Case list of mobile worker and want to display that count in Case details/case list.

Thanks for your help in advance.

HI @Mazz .... Let me explain…

A mobile worker visits a village and register a Child death as a case if it happens there. That child death case appears in Mobile worker Case list. Mobile worker visits and register Child death if it happens again in his/her village thus in the case list , Child death shows as a case list.

Now i want to count the number of cases (Child Death) showing in Case list of mobile worker and want to display that count in Case details/case list.

Thanks for your help in advance.

Hi Khan

Ok, what you're asking for can be done. but one question first, does the "child_death" case have a parent case?

If not, what you can do is have the same number of show up in a caselist that shows the "child_death" cases. unless, there's some other parameter like the village or something where you can probably make it show the count of "child_death" cases in the same village as the case in that row in the caselist.

HI Mazz....

Can you please let me know how can i count case list IF

Child death has no parent case or

Child death has a parent case too ???

https://confluence.dimagi.com/pages/viewpage.action?pageId=43485609

that should point you in the right direction.

in the caselist details you can stick this in a calculated property
count(instance('casedb')/casedb/case[location_field=@location_field][@status = 'open'])
this should theoretically return the count of cases whose location is the same as the case in that row. but, in my experience, counts in caselist details can act a little funny depending on your conditions and your mobile worker structures.

in the case you have a parent, use this code
count(instance('casedb')/casedb/case[index/parent = @case_id][@status = 'open'])

HTH