Tip |
---|
This is now supported in the Application Builder using the 'Custom Single and Multiple Answer Questions' Feature Previewadd on. For more information about how to turn on this feature please see Add-Ons and Feature Previews. |
Warning | ||
---|---|---|
| ||
The instructions below are for advanced users only; Dimagi may not be able to help if you attempt to make changes to xml by hand and make a mistake. |
Warning | ||
---|---|---|
| ||
Full access to this feature is only available for projects on a Standard software plan or higher. For more information, see https://www.commcarehq.org/pricing/ |
Step 1: Turn on the Feature Preview
Inside your form, you want to display existing cases in a checklist or single select question. To do this, you need to turn on a Feature Preview enable an Add On called "Custom Single and Multiple Answer Questions". This allows you to display custom choice lists in forms (i.e. a list of case sharing groups) instead of just items from a Lookup Table.
...
- In your form, add a new Checkbox Lookup Table question
- Choose the Lookup Table Data item below the added question to configure the data that will be displayed in the question. Choose the (...) button and enter the following:
- Set the query expression to
instance('casedb')/casedb/case[@case_type='your_type']
(Replacing your_type with the case type you want to display) - Set instance ID to
casedb
- Set the Instance URI to
jr://instance/casedb
- Hit the Save button
- Set the value to
@case_id
- Set the label to
case_name
- Set the query expression to
Variations
- If you would like to restrict the cases shown to be only child cases of the chosen case which you are updating you can add the following to the end of the query:
[index/parent = instance('commcaresession')/session/data/case_id]
- If you would like to restrict the cases shown to be only open cases you can add the following to the end of the query:
[@status='open']
See also: Updating case properties based on the outcome of a multiple choice question