Skip to main content
Share Your Experience: Take the 2024 Developer Survey
6 votes

Regex validation - how to check for exactly 4 digits in Commcare integer field?

There are a couple of issues here. Regexes are typically only used for string fields inside CommCare ("Text", "Phone number or Numeric ID", hidden variables, etc). If you want to do a validation on ...
Jessica Long's user avatar
5 votes
Accepted

Difference between Default Value and Calculate Condition

Great question! You seem like a swell dude. The main difference between a calculate condition and default value is when the calculation will occur. Specifically, a default value will only be set once ...
Will P's user avatar
  • 131
5 votes
Accepted

Does the date filter for a CommCare case export filter forms by last modified date or opened date?

The date filter in the case export is based on modified date, not opened on. If you also look closely at the subtext it will remind you that it is filtering on when cases were modified. Note: ...
Ben Rudolph's user avatar
  • 1,274
5 votes
Accepted

Filtering an instance by a case property in my CommCare app

If you're filtering cases, you want an expression that ultimately returns a set of cases. The first part of the expression, instance('casedb')/casedb/case, gives you all cases on the phone. The ...
Jenny Schweers's user avatar
5 votes

How to reference name and surname of a user in CommCare

In order to do this you need to use something called Custom User Data. In the calculate condition of your hidden variable you can use an expression like this: instance('commcaresession')/session/user/...
Ben Rudolph's user avatar
  • 1,274
5 votes
Accepted

Are case types case sensitive in CommCare?

CommCare doesn't provide any specification about case-specificity in its underlying technical format, so the safest guaranteed behavior is to make is that the case types need to match, but to not make ...
Clayton Sims's user avatar
5 votes
Accepted

Can I list the parent_name of a child case in the child case module case list?

Yes, you can use parent/name for this.
Jenny Schweers's user avatar
5 votes

How can I change my CommCare worker monitoring reports to another language?

You can change your language preferences on your account settings page https://www.commcarehq.org/account/settings/
Jon Emord's user avatar
4 votes
Accepted

Expanding checkbox questions in CommCare case data export

The default settings of your project do not let you split mulitselect questions in case exports. This is because your case does not know which questions correspond with which case properties (because ...
Ben Rudolph's user avatar
  • 1,274
4 votes
Accepted

How to save label text as a case property to be referenced later in a CommCare application

One way to accomplish this is by loading the label text in a hidden variable's Calculate Condition and then reference that variable later. Create a hidden variable with your label text Add the label ...
Ben Rudolph's user avatar
  • 1,274
4 votes
Accepted

How to close a child case automatically when a parent case is closed in CommCare

If the project space as a Pro Plan or higher, you can now auto close the child case based on the parent case closure. It is now part of the standard drop-down options when you create an automatic case ...
Claire C's user avatar
  • 796
4 votes
Accepted

instance syntax to search for all child cases of a parent in CommCare

I'm assuming in this case that you've loaded a the member case into your form, and that you can load the member case ID id into /data/member_id What you want to get is: The count of all member ...
Clayton Sims's user avatar
4 votes

module filter with multiple expressions

Yes, you can do that using an and or an or operator. To combine your expression you can do this: (count(instance('commcaresession')/session/user/data/role) > 0) and (instance('commcaresession')/...
Ben Rudolph's user avatar
  • 1,274
4 votes
Accepted

In CommCare, can you specify the order that choices from a Multiple Choice Lookup Table will appear in? (example: alphabetically by display value)

For lookup tables The order of choices from a Multiple Choice Lookup Table are defined by the order that they are uploaded in. Therefore if you a column in your lookup table that looks like: Color --...
Ben Rudolph's user avatar
  • 1,274
4 votes
Accepted

Are there any crucial risks to allowing mobile users sign in with the same username and password to collect data in CommCare?

There are some assumptions that get made about the locality of a user to a single device. If the same user logs into multiple devices there are some edge cases where they won't see updated data that ...
Simon's user avatar
  • 476
4 votes
Accepted

Saving child form information to parent case

Yes, you can save the particular question from a child case form that you wish to save as the property to the parent case by typing "parent/[property name]" in the case management settings page of the ...
Merv's user avatar
  • 243
4 votes
Accepted

What are the benefits of case sharing via locations vs. case sharing groups

The organizations feature is meant to map to organization hierarchies, and is useful for larger projects where you may have, for instance, district managers who oversee a subset of the project. There ...
Ethan Soergel's user avatar
4 votes
Accepted

How to set up a CommCare excel import to update a case property to null

What you're trying to do is slightly tricky and has tripped up many of us, but fortunately it is possible! I assume you tried to do an import with 2 columns, one for case_id with the IDs of all the ...
Jennifer's user avatar
  • 506
3 votes
Accepted

How do you load a case_id into a form

You can use the session instance path to get the currently selected case's case_id (see CommCare Session Instance help page): instance('commcaresession')/session/data/case_id The link above also ...
Ali F's user avatar
  • 228
3 votes
Accepted

Is it possible to use a repeat group to iterate over a space-separated list?

A repeat group is capable of iterating over a space separated list with a Model Iteration query, but like any repeat group auto-expansion, this can only occur over a set of values which is fixed when ...
Clayton Sims's user avatar
3 votes

Is it possible to put a casedb expression in a CommCare module filter?

Yes, this is possible. The module filter (for module with case-type "notification") ends up being: count(instance('casedb')/casedb/case[@case_type = "notification"][@status = "open"]) > 0 The [@...
Jennifer's user avatar
  • 506
3 votes

Show only first n cases in a caselist?

This can be accomplished by adding a filter based on the position() of the current element, but the syntax will be a bit of a hack because you need to introduce a second predicate filter after the ...
Clayton Sims's user avatar
3 votes
Accepted

Is it possible to configure the date widget in CommCare to use DD/MM/YYYY instead of MM/DD/YYYY?

The ordering of the date fields (day, month, year) is actually determined by the default language settings on your phone. To get the dates to appear as MM/DD/YYYY, go to the Android Settings -> ...
Jennifer's user avatar
  • 506
3 votes
Accepted

In CommCare, which date case property references the date the case was created?

Just to add onto Ben's answer - CommCare and CommCare HQ have different representations of the case data which is why this is confusing. The case closure rules rely on CommCare HQ's representation ...
Cory's user avatar
  • 308
3 votes

In CommCare, which date case property references the date the case was created?

Confusingly enough, the proper way to access the opened date of a case in a form is to use the opened_on property. Both opened_date and date-opened are aliases for the opened_on property.
Ben Rudolph's user avatar
  • 1,274
3 votes

Assigning cases to locations via Case Importer

In order to have a case be owned by a location, you need to set the owner_id column in the Excel file being uploaded. This requires a two-step process. Getting the location_id from your list of ...
Ben Rudolph's user avatar
  • 1,274
3 votes
Accepted

What does an irrelevant question evaluate to in CommCare?

If question_1 is irrelevant, but the question exists in the form, references to the question will evaluate to an empty value (ie: '') and should not cause errors. References to the element's node in ...
Clayton Sims's user avatar
3 votes
Accepted

Saving location name from multiple choice lookup table as a case property

Assuming your question is named /data/location_id_result, you can reference the name of the location selected with the expression instance('locations')/locations/location[@id = /data/...
Clayton Sims's user avatar
3 votes

How to reference a child case in a display condition

Yes, you can do that in the Advanced Mode of the Display Condition. You will need: count(instance('casedb')/casedb/case[index/parent = instance('commcaresession')/session/data/case_id][@status = '...
Ben Rudolph's user avatar
  • 1,274
3 votes
Accepted

Viewing supply point cases at a supervisory level

When using organization-based case sharing, any location levels whose cases you want to be shared need to be tagged as "owns cases". The same rules apply to CommCare Supply. The supply points are ...
Cory's user avatar
  • 308

Only top scored, non community-wiki answers of a minimum length are eligible