how to stop the data entry program after entering 1 case

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

how to stop the data entry program after entering 1 case

Post by Jing Liu »

Hi,

I would like to use a shell menu to control the case id entered into one data file. e.g. the pff file is as below. But then when i complete the questions, I get the error message "case ids xxx duplicate an existing case! case ids must be unique".
I would like to complete one case and then let the data entry program save the data and show down it automatically. Then I would like to get back to the shell menu to select another household from the list and regenerate the pff file for data entry. Is that possible??

best regards

jing

[Run Information]
Version=CSPro 6.1
AppType=Entry

[DataEntryInit]
Fullscreen=Yes
NoFileOpen=Yes
Interactive=Both,Lock
OperatorID=001
StartMode=ADD;00100002
Lock=Verify,Stats

[Files]
Application=C:\FAFO\CSpro\AndroidTest\Entry\AndroidTest.ent
InputData=C:\FAFO\CSpro\AndroidTest\Data\H001001.DAT
Listing=C:\FAFO\CSpro\AndroidTest\Data\H001001.LST

[ExternalFiles]
SAMPLEPLUS=C:\FAFO\CSpro\AndroidTest\Ref\SAMPLEplus.DAT
RSIINFOEXPORT=C:\FAFO\CSpro\AndroidTest\Ref\RSWinfo001.DAT

[Parameters]
Parameter=I00100100002 00
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: how to stop the data entry program after entering 1 case

Post by Jing Liu »

Hi,

It is entry message (W 92101), and there is no way to shut it down.

I have to get to the 'start task manager' to end the program there.


Jing
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: how to stop the data entry program after entering 1 case

Post by josh »

The probem is that when CSEntry is in add mode and you complete a case it automaticaly starts the next case. This behavior makes sense when you don't set the case ids in the pff file but when you do that it tries to start a new case with the same ids as the last ones which is an error. The easiest solution is to call stop in the postproc of the questionnaire (level postproc). This will end data entry after the first questionnaire is completed.
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: how to stop the data entry program after entering 1 case

Post by Jing Liu »

Hi,

Thanks for that, it show down now. May I ask one more question, I tried to use the following code to generate a pff file to call the data entry application.

it generates the pff file and if i run directly the pff file, it works. but when i use the CSrun(), it seems opening the data entry application, but then get dead, you may see the attached screen print.

the pff file is the same as i show before.

best

Jing




CSrun( xQuesType, xSavPart, xReVisit, xChange );

functions related:

{Initial lines for PFF files, since all applications are of data entry type the first lines are the same for most of them}
function InitPFF()
setfile( PIFfile, concat( strip(DirEntry), "\", strip(EntryEnt), ".pff" ) );
FileDelete( PIFfile );
FileWrite( PIFfile, "[Run Information]" );
FileWrite( PIFfile, "Version=CSPro 6.1" );
FileWrite( PIFfile, "AppType=Entry" );
FileWrite( PIFfile, " " );
FileWrite( PIFfile, "[DataEntryInit]" );
FileWrite( PIFfile, "Fullscreen=Yes" );
FileWrite( PIFfile, "NoFileOpen=Yes" );
FileWrite( PIFfile, "Interactive=Both,Lock" );
FileWrite( PIFfile, concat( "OperatorID=", ThisDeviceCode ));
end;

{Generates a PFF file for data entry}
function GenPFF ( QuesType, SavPart, ReVisit, Change )
GenDataFName(QuesType);
InitPFF();
if chkDFexist(QuesType) = 0 then
//xAddMode = 1;
FileWrite( PIFfile, concat( "StartMode=ADD;", strip(xCase) ));
elseif chkDFexist(QuesType) = 1 then
if chkCase(QuesType) = 0 then
//xAddMode = 1;
FileWrite( PIFfile, concat( "StartMode=ADD;", strip(xCase) ));
elseif chkCase(QuesType) = 1 then
if PartialSav(QuesType) = 1 then
//xAddMode = 1;
FileWrite( PIFfile, concat( "StartMode=ADD;", strip(xCase) ));
elseif PartialSav(QuesType) in 2,0 then
//xAddMode = 0;
FileWrite( PIFfile, concat( "StartMode=MODIFY;", strip(xCase) ));
endif;
endif;
endif;
{if xAddMode = 1 then
FileWrite( PIFfile, concat( "StartMode=ADD;", strip(xCase) ));
elseif xAddMode = 0 then
FileWrite( PIFfile, concat( "StartMode=MODIFY;", strip(xCase) ));
{if SavPart = 1 then
FileWrite( PIFfile, concat( "StartMode=ADD;", strip(xCase) ));
elseif SavPart in 2,0 then
FileWrite( PIFfile, concat( "StartMode=MODIFY;", strip(xCase) ));
endif;}
endif;}
FileWrite( PIFfile, "Lock=Verify,Stats" );
FileWrite( PIFfile, " " );
FileWrite( PIFfile, "[Files]" );
FileWrite( PIFfile, concat( "Application=", strip(DirEntry), "\", strip(EntryEnt), ".ent" ));
FileWrite( PIFfile, concat( "InputData=", DataFname ));
FileWrite( PIFfile, concat( "Listing=", ListFname ) );
FileWrite( PIFfile, " " );
if ExtDict1 <> "" then
FileWrite( PIFfile, "[ExternalFiles]" );
FileWrite( PIFfile, concat( strip(ExtDict1), "=", strip(DirWrkprj), "\", strip(ExtPath1) ));
if ExtDict2 <> "" then
FileWrite( PIFfile, concat( strip(ExtDict2), "=", strip(DirWrkprj), "\", strip(ExtPath2) ));
if ExtDict3 <> "" then
FileWrite( PIFfile, concat( strip(ExtDict3), "=", strip(DirWrkprj), "\", strip(ExtPath3) ));
endif;
endif;
endif;
{Customize parameters for different types of data entry modes}

xparamet[1:1] = DataFcodes[QuesType:1]; {H/I data entry}
xparamet[2:3] = strip(ThisDeviceCode); {This device code}
xparamet[5:3] = strip(xCluster); {Cluster ID}
xparamet[8:5] = strip(xHousehold); {Household ID}
xparamet[13:2] = strip(xRSI); {RSI roster ID}
xparamet[15:1] = edit( "9", SavPart ); {case saved partially}
xparamet[16:1] = edit( "9", ReVisit ); {to run modify mode}
xparamet[17:1] = edit( "9", Change ); {if this is a revisit}
FileWrite( PIFfile, " " );
FileWrite( PIFfile, "[Parameters]" );
FileWrite( PIFfile, concat( "Parameter=", xparamet ));
close( PIFfile );
end;

function RunPFF ()
{Using single quotes instad of double quotes as double quotes are needed in the string generated}
TheCommand = concat ('"', strip(DirCSpro), '\CSEntry.exe" ', strip(DirEntry), '\', strip(EntryEnt), '.pff');
ExecSystem( strip(TheCommand), maximized, wait );
end;


{Function used to run and execute the data entry applications}
function CSrun ( QuesType, SavPart, ReVisit, Change )
{Parameters - QuesType, 1-Household, 2-RSI
AddMode, if first add or parttial save
SavPart, if the case was partially saved (1-partial add, 2-partial modify, 0-new/complete)
ReVisit, if it is a revisit to an incomplete interview (result code <> 1)
Change, advance to the first after the control of visits}
GenPFF( QuesType, SavPart, ReVisit, Change );
RunPFF ();
//BackupF();
end;
Attachments
screenshot.png
screenshot.png (37.73 KiB) Viewed 5563 times
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: how to stop the data entry program after entering 1 case

Post by Jing Liu »

HI,

one more strange thing, the last digit of the parameter section never get saved. help says I can save as long as I want for parameter.

xparamet[17:1] = edit( "9", Change ); {if this is a revisit}



best

Jing
Post Reply