Filter case list by user property

How to filter case list by user property

Hi Meango,

You can find information about how to filter a case list on our help site
page Case List and Case Detail Configuration
https://confluence.dimagi.com/display/commcarepublic/Case+List+and+Case+Detail+Configuration#CaseListandCaseDetailConfiguration-FilteringtheCaseList
page. You can use Custom User Data
https://confluence.dimagi.com/display/commcarepublic/Custom+User+Data or User
Case https://confluence.dimagi.com/display/commcarepublic/User+Case
properties in the filter expression to filter the case list by your desired
user property. Hope this helps!

Cheers,
Kaley

··· On Thu, Dec 7, 2017 at 7:04 AM, Meango Jean Marie wrote:

How to filter case list by user property

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Kaley B. Lambden
Senior Field Manager | Dimagi, Inc.
Skype: kaley.lambden

Hi @Kaley_Lambden thanks for the information. In the examples in the help documents it looks like you can filter case lists based on criteria related to the case, or related to the user, but I was wondering if you can filter the case lists based on criteria related to both the case and the user.

For example, it seems like I could configure the app to display cases where the answer to "form question 1" = "facility A", or I could configure the app to display cases where I've added "custom user data field 1" = "facility A". Is there any way to configure the app to display cases where "form question 1" = "custom user data field 1"?

Hi Natalie,

You can combine the two filter expressions with and to filter the case
list based on both criteria.

-Clayton

Hi Clayton,

An AND filter would not work here because you would still need to define the answer to both questions in the filter (e.g., “form question 1” = “facility A” AND “custom user data field 1” = “facility A”), and thus this criteria would never be true for any users or cases with the answer "facility B". I was wondering if you could filter based on the criteria that the two answers were equal without having to express what exactly they equal, so that cases in facility A would show up to users in facility A, and cases in facility B would show up for users in facility B.

I know that's a long shot, but I was wondering anyway.

Hi Natalie,

If this is what you need:

it sounds to me like your best bet may actually be case sharing rather than trying to filter the case list, especially if/as your project grows. You can configure your users such that they only see cases in the facility to which they're assigned. Check out this wiki: Case Sharing - CommCare Public - CommCare Public

If you've got more complex needs, you could probably put together a rather ugly conditional statement for the filter, like if(question 1 = A, user data field = A's complement, if(question 1 = B, user data field = B's complement, etc., where you carefully lay out all the combinations. Some support for that type of endeavor here: CommCare Functions - CommCare Public - CommCare Public