Function to capture demode and ispartial

Discussions about CSEntry
Post Reply
bukanpeneliti
Posts: 6
Joined: October 27th, 2021, 10:34 pm

Function to capture demode and ispartial

Post by bukanpeneliti »

Hi, everyone

I'm trying to store information about data entry mode, i.e. whether the case is in add or modify mode, and whether the case is partially saved, i.e. ispartial() = 1.

I made the following function in my application

Code: Select all

function masih_partial()
	
	if demode() = 1 & ispartial() = 1 then
		masih_partial = 1;
	elseif demode() = 1 & ispartial() = 0 then
		masih_partial = 2;
	elseif demode() = 2 & ispartial() = 1 then
		masih_partial = 3;
	elseif demode() = 2 & ispartial() = 0 then
		masih_partial = 4;
	endif;

end;
the result of this function will be stored in an item named AKHIR2 in my application. My goal is whenever the interviewers upload the data into the server, the case status will be reflected by the value of AKHIR2. However, it doesn't work all the time. it failed to capture the value 4, after endlevel is executed at the end of my application.

I put this function in OnStop() global function, postproc in PROC LEVEL, and the last item in my form.

does anyone have any idea where to put the function to achieve my goal?

cheers,
Hafiz
justinlakier
Posts: 210
Joined: November 21st, 2022, 4:41 pm

Re: Function to capture demode and ispartial

Post by justinlakier »

Hello,

See EndLevel documentation. Endlevel's use depends on where it is called, however it is likely that you are skipping the function call entirely and the function should go before your call to endlevel.OnStop should be activating as long as you are not ending the application with stop(). You can try debugging with error messages in different locations to see how the flow of the application is progressing before it closes. It is possible you are not getting to the function calls, or that the function is not operating like you would like. If you cannot find the problem, you can attach your zipped application here or at cspro@lists.census.gov with details about the expected behavior and what is not working.

Hope this helps,
Justin
Post Reply