savepartial and onstop are not closing case

Discussions about CSEntry
Post Reply
Keith Tomlin
Posts: 56
Joined: March 23rd, 2014, 9:30 am

savepartial and onstop are not closing case

Post by Keith Tomlin »

Hi -

I have an Android application where location/person identifiers are entered, and then a few questions in there is a question about consent. If consent is not given, then the interview ends and the case is closed. I want to then write logic so that if the interviewer tries to open that case again, they simply get a message saying "consent not given by this household" and an OK button. i.e. I don't want the user to be able to re-open the case if consent is not been previously given.

I've run into various problems trying to do this, and am trying the following:-
1. At the very beginning of the dictionary I've added a protected (ie invisible) item called CONSENT_CLOSE which is set to 0 when data entry starts.
2. If consent is not given then, in the postproc for the consent question, the CONSENT_CLOSED item is set to 1. I then use savepartial and close(0) in the postproc of the consent question to exit the case.
3. If the user tries to re-enter the case they are asked if they want to go to the last position (I don't seem to be able to get around that) and when they say yes (which we always tells interviews to do) they go to the preproc of the consent question (as it was the last position) and if CONSENT_CLOSE = 1 then this does trigger the "no consent message". However, I have savepartial and close(0) in this 'if' clause too, but these don't close the case -instead it stays open. What am I doing wrong?

Any help very gratefully received.

Many thanks

Keith
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: savepartial and onstop are not closing case

Post by josh »

That sounds like it should work. I put together a simple test app that does roughly what you describe (see attachment). I made a few simplicications: rather than add the protected item I just used the consent variable itself and I don't call partialsave() after coming back from partial save since the case was already partial saved.
You do not have the required permissions to view the files attached to this post.
Keith Tomlin
Posts: 56
Joined: March 23rd, 2014, 9:30 am

Re: savepartial and onstop are not closing case

Post by Keith Tomlin »

Hi Josh - many thanks for your quick reply. I'm just about to head off to Ethiopia for survey preparation, but will take a look at your sample application in the next day or so.

All the best

Keith
Keith Tomlin
Posts: 56
Joined: March 23rd, 2014, 9:30 am

Re: savepartial and onstop are not closing case

Post by Keith Tomlin »

HI Josh - many thanks for taking the time to put together a test application for this. I've followed your syntax and it is working now, which is great. By the way, when I tried to open your test application I got an error message saying that the source code could not be found. Not sure what that was about? But I was able to follow your programming by opening your .apc file with Notepad++.

Thanks again

Keith
Post Reply