SavePartial() doesn't work inside OnStop()

Discussions about CSEntry
Post Reply
alex_izm
Posts: 19
Joined: December 9th, 2016, 11:31 am

SavePartial() doesn't work inside OnStop()

Post by alex_izm »

Hi, sorry if this has been answered before. I searched the forum but didn't find the answer.

I've tried the example from the help of OnStop(), but I'm getting this error message:

Image

Here is the distilled code:

Code: Select all

PROC GLOBAL

function OnStop();
  savepartial();
  stop(1);
end;

PROC USERS_FF
preproc
  set behavior() exit on;
Using Windows CSPro version 6.3.2. I am getting this error message and the case is not saved no matter what field on the form was in focus at the time of closing the entry window.

Could you please tell me what I'm doing wrong?

Thanks in advance!!!
Alex
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: SavePartial() doesn't work inside OnStop()

Post by josh »

This appears to be a bug and one that has been around since at least version 5. It only occurs if you don't run any procs before the call to OnStop. We will add a proper fix but for now there is simple workaround. Add a dummy preproc for the first level. Something like:
PROC USERS_QUEST
preproc
//  This is does nothing but is a workaround to make the
// savepartial() work in OnStop()
numeric x = 2;
Adding that preproc forces CSPro to realize that it is on level one and not level zero and the savepartial will work.
Post Reply