Favorite Feature Friday – Form Display Conditions

CommCare is a powerful and robust tool that allows you to create everything from simple surveys to sophisticated applications with complex workflows. This flexibility comes from a multitude of features, and here at Dimagi we are always looking for new ways to use all of them. For this reason, we asked members of our Field Team to share their favorite CommCare features, and how they use them, with us (haven’t yet tried CommCare? Create an account for free here to follow along).

Form Display Conditions is the second feature in this series. You can see last Friday’s post about minimizing duplicate cases here

This Friday, learn how to use Form Display Conditions in CommCare with Dimagi’s Jeremy Wacksman!


 

Video: How to Use Form Display Conditions

Creator: Jeremy Wacksman, Dimagi Senior Project Manager

Topic: Form and Menu Display Conditions are very useful for creating different views of the same app for multiple users. Follow along with Jeremy as he walks through a demo of how Display Conditions work, and how to configure them in your app.

Need More Information?  You can read more about Display Conditions here.

Read the transcript below and keep an eye out for a new video every Friday with more of our Field Team’s favorite CommCare features!

 


 

Jeremy: Today I’m going to walk you through an example of how you might use Form Display Conditions, and then I will show you how to do the configuration in CommCareHQ.

The Problem

Here I’m logged in to a basic CommCare app, which has three different menus. I’m going to go into the Mothers Case List, which has four cases, some of which are pregnant and some of which are not. On the right side of the screen, the pregnant cases have a green icon and the cases that are not currently pregnant have a gray icon.

 

You may have instances where, for different cases, you want to see different sets of forms. For example, you may have a follow-up form that’s meant for pregnancy and you wouldn’t want to fill that form out for a woman who’s not pregnant.

To show you what this looks, if I go to the top case, Amy, which is a case that is pregnant, I see I have two forms – a follow-up form and a counseling form.

 

If I go back and choose Mary, who is not pregnant, I only have one form.

 

The follow-up form based on the Case Property for pregnancy is preventing that form from showing up for cases that are not currently pregnant. This is great for supporting users and adhering to different types of workflows. You can imagine that there are a lot of variations where it might be helpful to unlock forms based on case properties over time.

 

The Solution

Now, I’m going to hop over into CommCareHQ to show you how you can set this up.

Go to theFollow-up form Configuration Page. On the Settings tab, If you scroll down you’ll see that there’s an area here to add a Display Condition. You want to use the case syntax and the name of the Case Property, and then the value of the Case Property for which the form should show up. Here I’m saying if the Case Property, pregnant, equals yes, then this form should be displayed for that case (#case/pregnant = ‘yes’).

Don’t see the option to add a display condition? You need to add it in your Application’s settings. Read more here.

And that’s really all there is to it! Once you type in the syntax you can test it out and you’ll be able to display forms based on the value of different Case Properties.

Advanced Options

There are also other, more advanced, workflows and different applications of Display Conditions on forms and menus that you can use. These go beyond just looking at cases and have to do with user properties instead.

To show an example I’m gonna hop back to the app. I am on the menu screen again and I see those three menus. One of them is the supervision module menu. If I click on it you can reference information not only about the case, but about the user. You do so using a custom user data, or user-as-a-case. You can find more information on this on our help site:

Once you get these setup you can refer to user level properties as well. For example, you may want certain users who are supervisors to be able to see certain menus or forms. If I’m logged in as a supervisor in this particular instance I can see the Supervision Module, but if I log in instead with a different user who’s not a supervisor then this menu would be removed from the list.

Let me show you what that looks like. I’m going to logout from Nick (supervisor) and log in as Anne (non-supervisor.) Now you can see that that whole menu is not visible anymore just based on the different user that I logged in with.

The configuration for this on CommCareHQ is very similar. If I go to the Supervision Menu, this could be applicable either to the form or to the menu. You can specify Display Condition just like we did for the case. Here the syntax is a little bit different, we use the hashtag to tell Comcare we’re talking about the user and we’ll type in the name of the property and the value that we want in order for that menu or form to be displayed (#usersupervisor = ‘yes’).

Thanks so much, I hope you find some good use for Display Conditions!


 

Haven’t tried CommCare yet?

Starting app building!

Share

Tags

Similar Articles

The World's Most Powerful Mobile Data Collection Platform

Start a FREE 30-day CommCare trial today. No credit card required.

Get Started

Learn More

Get the latest news delivered
straight to your inbox