Dear Arjun
I am using this syntax to get report on tablet.
Pro_code is "EA number"
Function ViewListingReportSup()
{**********************************************************************}
{*** FIRST CHECK ENUMERATION AREA IS ASSIGNED OR NOT ****}
if fileexist(concat ("..\106_Ext_Data\AssignListing-", edit("9999999", Pro_Code), ".txt")) then
else
errmsg ("[...%04d...] Area for Listing is not Assigned.",Pro_Code);
Move to PRO_SUP_ID; //add new line
// Move to PBN;
endif;
filedelete ("..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+"*.csdb");
fileconcat (LISTING_DICT_NSER, "..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb","..\104_Data\Listing_NSER\Listing-"+edit("9999999",Pro_Code)+"-"+"*.csdb");
if fileexist("..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb") then
setfile(LISTING_DICT_NSER, "..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb");
numeric Interview=0;
numeric RefusedCases=0;
numeric Closed = 0;
numeric Totallisting=0;
numeric countdwelling=0;
numeric countnondwelling=0;
numeric countcnic=0;
numeric countqrc=0;
numeric totalcnic=0;
numeric totalqrc=0;
keylist(LISTING_DICT_NSER,enteredKeys);
Totallisting=length(enteredKeys);
forcase LISTING_DICT_NSER do
//where SW_Assign_To =822
// if loadcase(LISTING_DICT) <>0 then
if L_Q9=1 then
RefusedCases=RefusedCases+1;
elseif L_Q9=2 then
Closed=Closed+1;
elseif L_Q9=3 then
Interview=Interview+1;
else
endif;
if L_Q7=1 then
countdwelling=countdwelling+1;
elseif L_Q7<>1 then
countnondwelling=countnondwelling+1;
endif;
countcnic=count(L_Q13_1 where L_Q13_1<>notappl);
totalcnic=totalcnic+countcnic;
countqrc=count(L_Q14_1 where L_Q14_1<>notappl);
totalqrc=totalqrc+countqrc;
endfor;
setfile(reportFile, "..\106_Ext_Data\listinginfo.txt");
filewrite(reportFile, "LISTING INFORMATION");
filewrite(reportFile, "ENUMERATION AREA CODE IS " + edit("9999999",Pro_Code));
filewrite(reportFile, "-------------------------------------------");
filewrite(reportFile, "Interviewed: %d", Interview);
filewrite(reportFile, "Locked HH: %d", Closed);
filewrite(reportFile, "Refused: %d", RefusedCases);
filewrite(reportFile, "-------------------------------------------");
filewrite(reportFile, "Total Listed HHs: %d", Totallisting);
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "DWELLING AND NON-DWELLING INFORMATION");
filewrite(reportFile, "ENUMERATION AREA CODE IS " + edit("9999999",Pro_Code));
filewrite(reportFile, "-------------------------------------------");
filewrite(reportFile, "Dwelling: %d", countdwelling);
filewrite(reportFile, "Non-Dwelling: %d", countnondwelling);
filewrite(reportFile, "-------------------------------------------");
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "");
filewrite(reportFile, "CNIC AND QRC INFORMATION");
filewrite(reportFile, "ENUMERATION AREA CODE IS " + edit("9999999",Pro_Code));
filewrite(reportFile, "-------------------------------------------");
filewrite(reportFile, "Total number of CNIC: %d", totalcnic);
filewrite(reportFile, "Total number of QRC: %d", totalqrc);
filewrite(reportFile, "-------------------------------------------");
close(reportFile);
close(LISTING_DICT_NSER);
filedelete ("..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+"*.csdb");
else
errmsg ("You don't have listing data in the selected EA to view reports.");
move to PRO_SUP_ID;
endif;
// View report
if getos() = 10 then
// windows
execsystem(maketext("explorer.exe %s", filename(reportFile)));
elseif getos() = 20 then
// Android
execsystem(maketext("view:%s", filename(reportFile)));
else
// Win universal
errmsg("Reports not supported on this platform");
endif;
Move to PRO_SUP_ID; //add new line
// Move to PBN;
end;