Page 1 of 1

recover deleted cases?

Posted: April 12th, 2018, 6:14 am
by brettkeller
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

Re: recover deleted cases?

Posted: April 12th, 2018, 6:23 pm
by aaronw
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.

Re: recover deleted cases?

Posted: April 19th, 2018, 6:44 am
by Gregory Martin
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.

Re: recover deleted cases?

Posted: April 20th, 2018, 10:53 am
by brettkeller
Thank you! I was able to use the DB browser program to un-delete the cases.