problems with prefilled ID and partialsave

Discussions about CSEntry
Post Reply
robjnelson
Posts: 2
Joined: February 16th, 2023, 11:10 pm

problems with prefilled ID and partialsave

Post by robjnelson »

Greetings. I have two ID variables, one named SYSTEM_ID, which is autoincrement and protected in the form. The other is named STUDY_ID. For my data entry app, fields for both of these ID variables are in the main form, not in a household/parent form. If the value of another field, ELIGIBLE, is 0, then I want to prefill study_id with 9999, call partialsave, and close the record.
Here's the logic:
PROC ELIGIBLE
IF ELIGIBLE = 0 THEN STUDY_ID=9999;
OK=SAVEPARTIAL();
STOP();
ENDIF
Using this logic, I get the message "Error 8052 You cannot execute SavePartial until the ID items are filled in". If I set the value of STUDY_ID in PROC ELIGIBLE, but execute SavePartial at STUDY_ID's postproc, I get what I want but the user has to press Enter in the prefilled STUDY_ID field to execute the save.

PROC ELIGIBLE
IF ELIGIBLE = 0 THEN STUDY_ID=9999;
OK=SAVEPARTIAL();
STOP();
ENDIF

PROC STUDY_ID
POSTPROC
IF ELIGIBLE = 0 THEN OK=SAVEPARTIAL();
STOP(0);
ENDIF;

I don't have a programming background, but I think the problem is that prefilled 9999 in the STUDY_ID field isn't committed to STUDY_ID in the data until the user enters and then leaves that field. Is that correct? Regardless, is there another way to approach this?
Thanks in advance for your help.
Last edited by robjnelson on February 20th, 2023, 4:10 pm, edited 1 time in total.
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: problems with prefilled ID and partialsave

Post by khurshid.arshad »

Please see the attached file, which I have interpreted from your query.
best.
a
Attachments
prefilled.rar
(5.76 KiB) Downloaded 86 times
robjnelson
Posts: 2
Joined: February 16th, 2023, 11:10 pm

Re: problems with prefilled ID and partialsave

Post by robjnelson »

khurshid.arshad wrote: February 17th, 2023, 10:24 am Please see the attached file, which I have interpreted from your query.
best.
a
Many, many thanks! Your approach worked perfectly.
Post Reply