Runtime error!

Discussions about CSEntry
Post Reply
Stavros
Posts: 33
Joined: February 17th, 2014, 9:12 am

Runtime error!

Post by Stavros »

Hi all,

I am have created a program for a survey in which each Section is a different application. At the end of each section there is a navigation question and the logic used behind is based on the example of the Metro Survey.
However every first time that I choose to which section to go a keep getting an error message and the CSEntry stops working.
For the error message please check the following screenshot

https://www.dropbox.com/s/4zjscz87rmlnf ... 1.png?dl=0

If I open the case again into modify mode and go through all the answers the problem does not appear and I manage to load the other applications.
Any ideas why? As the field work will begin tomorrow I would appreciate a lot a quick answer.

Best,
Stavros
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Runtime error!

Post by Gregory Martin »

Hi Stavros,

It's hard to know what's going on without seeing the logic of your application. Can you send it to csprousers@gmail.com? I can take a look and see if I can figure out what's going on.
Stavros
Posts: 33
Joined: February 17th, 2014, 9:12 am

Re: Runtime error!

Post by Stavros »

Hi Gregory,

Unfortunately, I cannot send you my application mainly due to restrictions of the survey and because the application uses non-anonymous data from 2011.

I managed to solve my issue. The problem was when creating the logic for the new pff file, I used "endlevel" before "stop(1)". see the code below
PROC SEC_CHOOSE
//////////////////////////////////////////////////////////////////////////////////////////////////////
        if SEC_CHOOSE = 2 then
        
// 1) create new PFF file
        setfile(pffFile,strip(pffFileName2),create);

        
// 2) write out PFF file with data file based on keyer's name
        filewrite(pffFile,"[Run Information]");
        
filewrite(pffFile,"Version=CSPro 6.0");
        
filewrite(pffFile,"AppType=Entry");
        
filewrite(pffFile," ");

        
filewrite(pffFile,"[DataEntryInit]");
        
filewrite(pffFile,"Interactive=Ask");
        
filewrite(pffFile,"StartMode=add");
        
filewrite(pffFile,"FullScreen=Yes");
        
filewrite(pffFile," ");

        
filewrite(pffFile,"[Files]");
        
filewrite(pffFile,"Application=.\\Section 4\\HIF_KENYA_2014_FOLLOWUP_SECTION 4.ent");

        dataFileName =
maketext("%d.dat",HHID);

        
filewrite(pffFile,"InputData=%s\\%s",strip(dataFolderName2),strip(dataFileName));
        
filewrite(pffFile," ");

        
filewrite(pffFile,"[ExternalFiles]");
        
filewrite(pffFile,"HIF_Kenya_2014_DICT=.\\DATA\\Section 0,1\HIF_KENYA_SECTION_0&1");
        
filewrite(pffFile," ");
        
        
        
filewrite(pffFile,"[Parameters]");
        
filewrite(pffFile,"Parameter=%11d",HHID); // here is how we will pass the case ID to the data entry application
        filewrite(pffFile," ");
        
// 3) close PFF file
        close(pffFile);

        
// 4) create backup of data file
        filecopy(maketext("%s\\%s",strip(dataFolderName2),strip(dataFileName)),
                    
maketext("%s\\Backup\\%s_%d",strip(dataFolderName2),strip(dataFileName),sysdate("YYYYMMDD")));

        
// 5) launch the PFF file
        execpff(strip(pffFileName2));

        
// 6) close the menu program
        i=savepartial();
        
//endlevel; 
        stop(1);    
endif;
The reason I used endlevel was because I saw that by using only "stop" the cases remained as partially saved and I wanted to end them.
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Runtime error!

Post by Gregory Martin »

Are you able to launch your application from the postproc of your level? That way, you don't need to worry about prematurely ending it (and thus needing the savepartial code). If you're working on Windows, then your first CSEntry close as your new one opens. This is from the stop helps:
In a data entry application, if the stop function is executed in the Postproc of the first (highest) level then the data for the case is saved. Otherwise, any data entered for the current case is lost. If you want to avoid losing data, you should include a savepartial function just before the stop function (see example below).
Post Reply