Clearing / deleting all existing records in an application

92 views
Skip to first unread message

Eric Stephan

unread,
Sep 19, 2014, 5:27:29 AM9/19/14
to commcar...@googlegroups.com

Hello folks. This question is probably one that comes up once a week:

Because I am in a development phase, I am doing a lot of testing of apps, and of course I accumulate a lot of old garbage data.   And some of that old data is perhaps "tainted" by earlier, incorrect configurations... which can't help things either.

What is the best way for me to clear out / delete all the existing records of a database?   I seem to recall that there's no simple command for it -- or am I wrong?   Or maybe a workaround, like making a new clone of your app (with no data) and then deleting the old, "full of garbage data" app?

Give your recommendations about clearing out the house... thanks much!

Eric

Cory Zue

unread,
Sep 20, 2014, 9:30:17 AM9/20/14
to commcar...@googlegroups.com
Hey Eric,

Generally we recommend you do all testing with a test user account. Then when you want to clear the data you can just delete that account, which will delete all the data as well. More information is available on our wiki. If you haven't been using a test account, you can first reassign cases to a test user and then delete that user, or you can close the cases manually or (with a paid project) using the case importer.

If you have other ideas about how we can better support clearing data in CommCare feel free to post them on our uservoice.

Cory

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julia de Kadt

unread,
Sep 25, 2014, 4:59:56 AM9/25/14
to commcar...@googlegroups.com
Hi Cory,

This is also a question that I have had!

If we reassign cases to a test user and then delete that user, does that have the effect of actually deleting the cases and associated data from the system?

thank you!
Julia

Julia de Kadt

unread,
Sep 25, 2014, 5:22:21 AM9/25/14
to commcar...@googlegroups.com
Hi Cory,

Just to add to this - I've tried this out and it has worked to delete all data, with the exception of data in the message log. Is there a way to clear out this old data from the message log?

thank you!

Cory Zue

unread,
Sep 25, 2014, 8:31:41 AM9/25/14
to commcar...@googlegroups.com
Hi Julia,

Hi Cory,

Just to add to this - I've tried this out and it has worked to delete all data, with the exception of data in the message log. Is there a way to clear out this old data from the message log?

Glad this worked for you. The fact that it doesn't delete data in the message log sounds like it could be a bug. I'll file something in our tracking system and report back when we know more.

Cory

Irwin

unread,
Sep 25, 2014, 10:10:50 AM9/25/14
to commcar...@googlegroups.com
Hi Cory, 

     I was wondering how would you go about doing this? Also, while on the subject of case closing. Is there a way to set cases to close after a designated period of time? (i.e. 90 days)

Nate Haduch

unread,
Sep 25, 2014, 11:32:09 AM9/25/14
to commcar...@googlegroups.com
Hi Irwin,

Unfortunately, cases cannot be set to close after a designated period. Alternatively, here are a couple of ways to manually close cases in HQ if a mobile worker does not close the cases in their app: 

1. The Excel Case Importer can be used to do a bulk case close. For more information see this link: https://help.commcarehq.org/display/commcarepublic/Closing+Cases
2. The Reports -> Case List page can be used to generate a list of cases. Click the name of the case to pull up the case, then click “Close Case.” For more information, see “Manually Closing Cases” here: https://help.commcarehq.org/display/commcarepublic/Editing+Data+in+CommCare

Let me know if you have further questions,

Nate

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Nate Haduch

Technical Support Analyst
Dimagi, Inc | 585 Massachusetts Ave | Suite 3 | Cambridge, MA 02139
web: http://www.dimagi.com/

Julia de Kadt

unread,
Sep 29, 2014, 3:56:54 AM9/29/14
to commcar...@googlegroups.com
Thanks Cory! Please do let me know if you are able to figure this one out. Later on, I also looked at the data from exporting the case list, and the data for the deleted participants was also still there, although they no longer had a participant ID assigned. Is this perhaps related?

Nate Haduch

unread,
Sep 29, 2014, 4:43:15 PM9/29/14
to commcar...@googlegroups.com
Hi Julia,

I've followed up with you off this thread to continue looking into the data issues that you've reported here. 

Thanks,

-- 
Nate Haduch

Technical Support Analyst
Dimagi, Inc | 585 Massachusetts Ave | Suite 3 | Cambridge, MA 02139
web: http://www.dimagi.com/

Reply all
Reply to author
Forward
0 new messages