Should anyone be interested, here is an example how to automatically (1) concatenate several .dat files, (2) Create a .sst (sorting) file (3) sort cases ascending, (4) create a html file containing sorted cases for viewing in a web browser.
Code: Select all
elseif $ = 6 then // create an HTML file with concateneted .dat file
// First, concatenate all .dat files
fileconcat(maketext("%s\\Concatenation\\%d_concat.dat",strip(dataFolderName),sysdate("DDMMYYYY")),
maketext("%s\\%s",strip(dataFolderName),"*.dat"));
// Second, create .srt file
setfile(pffFile,"..\..\GDC_Questionnaire\Batch\SortKeyer.ssf",create);
filewrite(pffFile,"[CSSort]");
filewrite(pffFile,"Version=CSPro 4.1");
filewrite(pffFile,"[Dictionaries]");
filewrite(pffFile,"File=%s%s\\GDC_Dossiers.dcf","00.00.00 00:00:00,",strip(entryFolderName));
filewrite(pffFile,"[SortType]");
filewrite(pffFile,"Type=Questionnaire");
filewrite(pffFile,"[Keys]");
filewrite(pffFile,'Key=Ascending,NUMDOSID,"Numero de dossier"');
// Third, run .srt file
setfile(pffFile,"..\..\GDC_Questionnaire\Batch\SortKeyer.pff",create);
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 4.1");
filewrite(pffFile,"AppType=Sort");
filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=%s\\SortKeyer.ssf",strip(batchFolderName));
filewrite(pffFile,"InputData=%s\\Concatenation\\%d_concat.dat",strip(dataFolderName),sysdate("DDMMYYYY"));
filewrite(pffFile,"OutputData=%s\\Concatenation\\%d_concat.srt",strip(dataFolderName),sysdate("DDMMYYYY"));
filewrite(pffFile,"Listing=%s\\SortKeyer.lst",strip(batchFolderName));
filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"ViewListing=OnError");
filewrite(pffFile,"ViewResults=No");
close(pffFile);
execpff(filename(pffFile));
// Fourth, create HTML file from .srt file
setfile(pffFile,"..\..\GDC_Questionnaire\Batch\BatchHTML.pff",create);
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 4.1");
filewrite(pffFile,"AppType=Batch");
filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=%s\\BatchHTML.bch",strip(batchFolderName));
filewrite(pffFile,"InputData=%s\\Concatenation\\%d_concat.srt",strip(dataFolderName),sysdate("DDMMYYYY"));
filewrite(pffFile,"Listing=%s\\BatchHTML.lst",strip(batchFolderName));
filewrite(pffFile,"[UserFiles]");
filewrite(pffFile,"HTML=%s\\Questionnaires.html",strip(htmlFolderName));
filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"ViewListing=OnError");
filewrite(pffFile,"ViewResults=Yes");
close(pffFile);
execpff(filename(pffFile));
reenter;