Page 1 of 1

loadcase

Posted: May 9th, 2018, 12:35 pm
by pelin
Hi, i have problem when using the loadcase comment. My problem is that i want another form to be opened for open-ended questions. The external form works well but when it comes to the loading stage, there is no data stored in the data file. Even when I type something in it, it becomes blank when i go back to that field. I would be glad if you could help me on this.

Here is my code:

alpha(60) wothresp; { Other answers response }
numeric wothcode; { Other answers code }

{ Function to ensure proper entry and updating of "Other" answers }
function getother( alpha(10) questnum, questocc );
{ Create alpha id for other answers file }
{ If your ID is not 7 characters in length, remember to fix the length of the level 1 ID and of OTHID in OTHERS.DCF }
OTHID = concat(edit("999",D), edit("999", F));
OTHQUES = questnum; { question number }
OTHOCC = questocc; { occurrence for multiple section/group or
multipart question }
{ Get the previous response back if already entered
in case of backtabbing or updating }

if !loadcase(OTHERS,OTHID,OTHQUES,OTHOCC) then
{ Otherwise initialize to blanks }
OTHRESP = " ";
OTHCODE = 0;
endif;
wothresp = OTHRESP;
wothcode = OTHCODE;
end;

PROC H01

postproc
{ Get Other Answer }
if $ = 4 then
getother( GetSymbol(), 0 );
enter FL_OTHERS
endif;

Re: loadcase

Posted: May 10th, 2018, 1:09 pm
by Gregory Martin
The function loadcase loads from an external file, but you will also need to update the file by using writecase. Try putting this at the bottom of your code:
PROC OTHSEC

    writecase(OTHERS);
It will save the "other" data to the file after it has been entered on the external form.

Re: loadcase

Posted: May 10th, 2018, 1:10 pm
by sah
Kindly check the following sample from
CSPro\Examples 7.1\1 - Data Entry\Using External Files & Forms

Re: loadcase

Posted: May 11th, 2018, 4:08 am
by pelin
Oohhh you are right!!! I totally forget about the write case function :o Thank you very much :)