Generate report

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Arjun Brti
Posts: 49
Joined: October 15th, 2020, 3:40 am

Generate report

Post by Arjun Brti »

Dear all,

How can we generate the "Completion report and/or Population report" by EA area and Interview status, like cross table. I want to generate the report like this attached;

Thank you.

Best
Btri
Attachments
Capture.PNG
Capture.PNG (5.38 KiB) Viewed 1767 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Generate report

Post by Gregory Martin »

You will have to give more details about how you are trying to do this. Are you working a data entry, batch, or tabulation application?

How do you want the report to be generated? Text, HTML, something else?

You may want to look at page 58 of the training materials as they show how to create text reports: https://www.csprousers.org/resources/CS ... rkshop.pdf
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Generate report

Post by khurshid.arshad »

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;
Attachments
report.jpg
report.jpg (83.61 KiB) Viewed 1734 times
Post Reply