I am writing out a file as a report from a roster, the codes below compiles alright but no output.
The list of households are found in roster (HHROSTER) and i will like to generate a report per EA, based on the EA
selected all the households identified in the roster comes out. Hope i can be assisted here.
Code: Select all
function ReportGenerator1()
string tempDirectory = pathname(Application) + "../temp/";
dircreate(tempDirectory); // make sure directory exists
setfile(ReportTxtFile, tempDirectory + "AllStructuresListed.txt");
// Write report to file
//string tempDirectory = pathname(Application) + "../temp/";
dircreate(tempDirectory); // make sure directory exists
setfile(reportFile, tempDirectory + "All Listed Cluster.txt");
Open( LISTING_DICT );
Xline=1;
numeric i=1;
while loadcase( LISTING_DICT ) = 1 do
do numeric ctr = 1 while ctr <= totocc(LISTING_DICT.HHROSTER)
filewrite(ReportTxtFile, " ");
filewrite(ReportTxtFile, "Report 1 - Supervisor Level");
filewrite(ReportTxtFile, " -------------------------------------------------------------------------------");
filewrite(ReportTxtFile, " │ ## │Int.ID │EA Code│Struc.## │HH ID │ Detail Address│Househead Name│");
filewrite(ReportTxtFile, " -------------------------------------------------------------------------------");
filewrite(ReportTxtFile, "│02%d │ %3d │ %10d │ %4d │%2d │ %40s │ %40s │",LID(ctr),Interv2(ctr),EACODE2(ctr),STRUCT2(ctr),LID(ctr),strip(ADDRESS2(ctr)),strip(LQ4(ctr)));
ctr = ctr + 1;
enddo;
enddo;
close(ReportTxtFile);
// View report
if getos() = 10 then
// windows
execsystem(maketext("explorer.exe %s", filename(ReportTxtFile)));
elseif getos() = 20 then
// Android
execsystem(maketext("view:%s", filename(ReportTxtFile)));
else
// Win universal
errmsg("Reports not supported on this platform");
endif;
end;