recover deleted cases?

Discussions about editing and cleaning data
brettkeller
Posts: 2
Joined: April 12th, 2018, 6:09 am

recover deleted cases?

Postby brettkeller » April 12th, 2018, 6:14 am

Hi - I'm working with a team that has collected data using CSPro. They collected the data on Android tablets and it has all been transferred to a central database. When I review the database (opening the .csdb file) in CSPro and select View > Show All Cases, I see a number of cases with a strikethrough in the left frame. When I select one of those cases, the right frame shows the data but at the top it says 'This case was deleted'. I know that the data still exists because I can see it displayed there. I believe some of these deletions were done in error and need to recover the data. Is there a way to recover all of the deleted cases, or to do so one by one? Thanks!

-Brett

aaronw
Posts: 52
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: recover deleted cases?

Postby aaronw » April 12th, 2018, 6:23 pm

Currently you can't do this in CSPro, but you can use a SQLite database manager. I use DB Browser for SQLite. Open the CSDB file and you'll be able to edit the deleted flag.

If you don't want to allow your interviewers to delete cases you can specify Lock=Delete in the PFF file.

Gregory Martin
Posts: 953
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: recover deleted cases?

Postby Gregory Martin » April 19th, 2018, 6:44 am

To add to Aaron's post, the only way to currently do this is to edit the .csdb file, which is a SQLite file. You can actually do this in CSPro with version 7.1. This, for example, will recover a case with the ID 0001, using the Simple CAPI dictionary:

sqlquery(SIMPLECAPI_DICT, "UPDATE `cases` SET `deleted`=0 WHERE `key`='0001'");


The caveat to this approach is that, while your case will be undeleted, I don't believe that it will sync unless you modify it (because the last_modified_revision value won't be changed). However, if you're doing this for local use, this approach should be fine.

brettkeller
Posts: 2
Joined: April 12th, 2018, 6:09 am

Re: recover deleted cases?

Postby brettkeller » April 20th, 2018, 10:53 am

Thank you! I was able to use the DB browser program to un-delete the cases.


Return to “Editing”