Updating Cases - Update Cases of a single Case Type
In order to properly update the cases of a single case type, we recommend that you follow these steps:
Step 1: Setup the import file to update a single case type
Instead of renaming the tab to one of the cases in your project when updating a single case type, use a generic name such as Sheet_1.Â
Step 2: Import the file
You have now created the Excel file to import and decided what unique ID to use to identify your cases. The next steps are to select the file for import and to specify the case type and the Excel column where your case ID is (so that CommCare HQ knows in which column of your Excel file the unique case ID is located).
Step 2a: Select the File to upload
In your project, go to the Data tab and select Import Cases from Excel.
Select your file and click on >> Next Step. This brings you to a page that looks like this
STEP 2b: Determine the case identifier
If you see a different page chances are that the name of the case was used to name one of the tabs in the Excel file and Commcare will automatically consider this file as an import that updates multiple case types in a single file, to rectify this rename the tab to a name that does not match any of the cases in the project.
On the page above of your project space, you will need to complete two actions 1. Specify the Case Type to Update/Create and 2. Identify the Case by Specifying the Case ID you want to use. We're now going to look at each of these action
First, you choose the case type that you want to update. Â
The next step is to tell CommCare HQ in which Excel column the unique ID is and what type of unique ID you're using. Follow the table below
IF | THEN |
---|---|
you're using case_id to update the cases (i.e. you did a case export from CommCareHQ), | choose info.case_id as your Excel column and the Corresponding case field as Case ID (see first screenshot below) |
you're using an existing Unique ID (ex. household number), | choose that column as your Excel column and the Corresponding case field as External ID. (see the second screenshot below) |
Using Case ID (CommCareHQ Export)
Using existing Unique ID (ex. household number)
Make sure you don't check "Create new cases if there is no matching case".  This will ensure you don't accidentally create new cases if you mistype an ID.
Step 3: Map the Case Properties and Complete the Import
You should now be on a page with the following interface
Map Excel Headers to Case Properties
The next step is to map the columns in your Excel document to case properties that you want to create: you basically want to tell CommCare HQ what name to give to the new case property or match the Excel column header to an existing case property. Understand in which situation you are following the table below and then complete the steps specified
IF | AND | THEN DO THIS |
You're updating existing cases | your application already has case properties | you can choose these for each Excel column. (Note that the tool will only show case properties that have been submitted. If you have not created a case yet, it will not show any case properties). |
You're updating existing cases | your application doesn't have a case property | you can choose to create a new one for the appropriate Excel column. The Auto Fill button will automatically match your Excel headers to the existing case properties' names. |
You are creating new cases |
|
Choose each Excel column you want to import and the case property you want to create or update. If you want to create a new case property, check "Create new property" and type in the name of the case property. Â
Once you've mapped all of your Excel columns, click on the Confirm Import button.
NOTE: If you're creating a new case property, following the above steps will only create the case property for the cases. It will not automatically create a case property under case management in the form builder.
Check for details in Recent Uploads
Upon starting an import, you will be returned to the landing page, and a new row will appear at the top of Recent Uploads, letting you view the progress of your import. Upon completion of the import, the following information will appear under details (messages only appear if the # isn't 0):
# rows matched and updated (corresponds to the number of cases updated for the Excel fields that you matched to case properties in the application)
# rows did not match any existing cases and had new cases created for them. If case_id's were used, these were ignored. (if you selected the option to create new cases, this indicates the number of new cases that were created where there were no matching Excel fields/case properties)
# rows matched more than one case at the same time (you may have multiple cases in your system with the same case_id, in which case the system will not update anything as it will not know to which case the new data corresponds)
The Form IDs and Case IDs download buttons will download a list of the corresponding ids that were created for that particular upload. These can then be used to bulk update cases or forms.