Case Management Development

Hello Everyone,

Need some advice please. I have a single farmer registration form which opens a case and then i have about 4 other forms that are a follow up to the registration form. While testing one of the follow up forms(farm mapping), i realized it was possible for a mobile worker to map the same farm more than once. Is it possible to have some setup specifically for the farm mapping survey to avoid this trap? Like if a mobile worker has already mapped a particular farmer’s farm, then the farmer name should be hidden from the case list for that particular form but the same farmer details should show up normally in the other follow up forms.

image

Hi Jay,

First you need a way to know whether a particular form has been filled out for a given farm. To do this, configure the Farm Mapping form for example, to set a property called farm_mapped to 'yes' on the farm case. Then you can set a display condition on the form to show it only if

not farm_mapped = 'yes'

Hi Ethan,

How do i configure this property without including it as a question in the registration form? The case management only pulls properties from the registration form.

@Ethan_Soergel, Just thinking, do i need to have a question in the farmer enrolment form that asks “Farm mapped?” and set a default answer as “no”

Then on the Farm mapping form, set the display condition to be if “farm_mapped” = no

Meaning the form would only show if that property is having a value of ‘no’

Is this right? if so, how does the property overwrite when a particular farm has been mapped?

You can add a hidden value with a calculate that’s just 'yes', then reference this in the case management screen. That way the user doesn’t need to see a question about this at all.

Then on the Farm mapping form, set the display condition to be if “farm_mapped” = no
Meaning the form would only show if that property is having a value of ‘no’
Is this right? if so, how does the property overwrite when a particular farm has been mapped?

That’s correct, that approach should work. The Enrolment form can set the property to 'no', and then the Mapping form can set the same property to 'yes'.

The approach I proposed in my previous message was to only modify the property in the Mapping form, so that if the property isn’t set, it’s an implied 'no'. This may require using the coalesce function in the display condition:

coalesce(./farm_mapped, 'no') != 'yes'

Either approach should work fine, whichever you prefer.

Hi @Ethan_Soergel,

I haven’t had time to implement this and just about to but i can no longer place this in the enrolment form as data collection already started. Can i plcae this hidden field in the follow up form(farm mapping) and how exactly would that work?

@Ethan_Soergel

So far i have created a question in the farm mapping survey that asks if the mapping is complete and then i have saved it as a case property with a default value of ‘no’

image

Does that work? How and where do i apply the coalesce function so i can hide a farmer name if the farmer’s farm has been mapped.

coalesce(./mapping_complete, ‘no’) != ‘yes’

That looks correct. You should now be able to reference that case property in the form display condition, using the coalesce function. Here is how to configure a form display condition: https://wiki.commcarehq.org/display/commcarepublic/Form+Display+Conditions

The expression coalesce(./farm_mapped, 'no') != 'yes' should go in the “Display Condition” box on the form settings page.

Hi @Ethan_Soergel,

For some reason the form is throwing up errors when i try to make a new version to test if the condition works

@Ethan_Soergel,

I have checked through and it seems this error is tailored to the condition. Cases are available for the form as it is a follow-up form and i think that also pertains to the case list showing up first before the form or is it possible that even though we have set forms for case management we still need to set them to be sure that the case list shows up before the forms?

@Ethan_Soergel

@JayH is the Farmer Enrolment form still in the same menu? That error message says that registration forms must go in a different case list (aka menu). I think you’ll need to move “Farmer Enrolment” out of “Farmers” and into another menu just for registration.

@Ethan_Soergel Yes its in the same menu. This behaviour seems a bit strange to me as i have never had to take out a registration form into a separate menu. All the same, i don’t think i can take it out as the form is currently being used to collect data or that doesn’t matter? Please advise.

The reason for this requirement is that this display condition determines whether to show the form based on the selected case, which means that the case list appears before the form (since that’s where the selected case comes from). However, with a registration form, the case list must appear after the form, since that form opens a new case. That means that the you can’t have a registration form and a form with a case-based display condition in the same menu.

Moving the registration form into a new menu shouldn’t affect existing cases, and new cases should also work fine. I don’t think there will be issues viewing registration forms in reports, though you could certainly test it out to be sure none of your workflows are affected.

@Ethan_Soergel Okay so what i have suggested is to wait till farmers have been enrolled before moving the form and testing it.

@Ethan_Soergel or to allow the farm mapping survey to be the final survey that closes the farmer case

Hi @Ethan_Soergel,

This error comes up after applying the coalesce statement to the display condition for the farm mapping survey, any ideas please?

Can you paste in the coalesce expression? I suspect you need to add quotation marks around “no”

@Ethan_Soergel