MENU APK

Discussions about creating CAPI applications to run on Android devices
Post Reply
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

MENU APK

Post by segxy4manu »

Good day folks and compliments of the season

I need an example Menu app guide that can allow me to share a collected data with other enumerators to conduct individual interviews.

The assigned Household will be done by the male interviewer that will get all Household members in a roster, after that he will share with female interviewers to conduct individual interview by assigning the individual household members in the roster to different female interviewers.

Thanks
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: MENU APK

Post by sherrell »

Have you looked at the menu apps that comes installed with CSPro? Specifically, in the

[1] C:\Users\<userID>\Documents\CSPro\Examples 8.0\1 - Data Entry\Synchronization In Logic\Menu
[2] C:\Users\<userID>\Documents\CSPro\Examples 8.0\1 - Data Entry\Labor Force Survey\Menu
[3] C:\Users\<userID>\Documents\CSPro\Examples 8.0\1 - Data Entry\CAPI Census\Menu

The first (synchronization) is just 152 lines, and has a supervisor & interviewer menu which shows syncing between the supervisor & interviewer using bluetooth, as well as the supervisor syncing to the CSWeb server.

The second (labor force) is ~330 lines, and also has a supervisor & interviewer menu which shows syncing between the supervisor & interviewer using bluetooth, as well as the supervisor syncing to dropbox. It also includes functions that create a PFF on the fly and launch it to invoke the data entry application itself, and how to create a few reports.

The third (CAPI census) app is the most extensive, clocking in at just under 1,300 lines. It expands further on the labor force menu by showing how to use the loadcase function to make name lookups, managing staff, creating unique supervisor PIN codes, etc.

To facilitate your review of the logic, you might want to turn code folding on at the PROC & Function level:

    From the Menu, choose Code > Code Folding > Level > Procedures and Functions Only

So you can then fold all to get a summary view of the functions present within the file. To fold all:

    From the Menu, choose Code > Code Folding > Fold All, or press Alt+0

Sherrell
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

Re: MENU APK

Post by segxy4manu »

Thanks Shorrel,
would have try to lay my hand on it but fear of beta version for an i want to deploy in 3 weeks time.

I would have prefer a stable app and also Ver 8.0 is looking entirely different from usual look, i will need to study and be sure it can fly.

Thanks.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: MENU APK

Post by sherrell »

Actually, the example applications that are bundled with the v8 install are the same example applications that are bundled with the 7.7 app--we have not added any new examples recently. And while "under-the-hood" files .ent and .dcf have changed format for v8, the apc (logic) file has not, so they are well tested/have been around for awhile. So, please check out the parallel folders:

[1] C:\Users\<userID>\Documents\CSPro\Examples 7.7\1 - Data Entry\Synchronization In Logic\Menu
[2] C:\Users\<userID>\Documents\CSPro\Examples 7.7\1 - Data Entry\Labor Force Survey\Menu
[3] C:\Users\<userID>\Documents\CSPro\Examples 7.7\1 - Data Entry\CAPI Census\Menu

Sherrell
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: MENU APK

Post by khurshid.arshad »

The code is provided below, and an external dictionary is included to store the roster for individual person selection.

Code
PROC F_SECTION_B//Forster form



    {Save household roster for female questionnaire}

   
if fileexist("..\..\106_Ext_Data\LF_"+edit("9999", A04)+edit("9999", A05)+".csdb") then//Looking lookup file based on the (A04 Area code) (A05 selected House num)

       
filedelete ("..\..\106_Ext_Data\LF_"+edit("9999", A04)+edit("9999", A05)+".csdb");
        setfile (ELIGIBAL_FEMALE_DICT, "..\..\106_Ext_Data\LF_"+edit("9999", A04)+edit("9999", A05)+".csdb",create); //ELIGIBAL_FEMALE_DICT External dictionary

   
else

        setfile
(ELIGIBAL_FEMALE_DICT, "..\..\106_Ext_Data\LF_"+edit("9999", A04)+edit("9999", A05)+".csdb",create);

    endif;


    numeric countrecord=count(SECTION_B where B03>=1); //count the record from the roster Section_B is the roster and B03 is relationship
   
IndexPID=1;

    LF_A01=A01;//LF_A01=External Dictionary = A01 from main dictionry
   
LF_A02=A02;//Same
   
LF_A03=A03;//Same
   
LF_A04=A04;//Same
   
LF_A05=A05;//Same
   
LF_A06=A06;//Same


   
for IndexPID  in SECTION_B do

        if 
IndexPID <=countrecord then

           
LF_B01(IndexPID)    =   B01(IndexPID); //LF_B01=External Dictionary = B01 from main dictionry - PID
           
LF_B02(IndexPID)    =   B02(IndexPID);//Same - Name
           
LF_B02A (IndexPID)  =   B02A(IndexPID);//Same - Want to Add More Member
           
LF_B03(IndexPID)    =   B03(IndexPID);//Same - Relation
           
LF_B04(IndexPID)    =   B04(IndexPID);//Same - Gender
           
LF_B05(IndexPID)    =   B05(IndexPID);//Same - Age
           
LF_B06(IndexPID)    =   B06(IndexPID);//Same - ID card information
           
LF_B07(IndexPID)    =   B07(IndexPID);//Same - Marital Status
           
LF_B08(IndexPID)    =   B08(IndexPID);//Same - Ever Attended school
           
LF_B09(IndexPID)    =   B09(IndexPID);//Same - Highest class
           
LF_B10(IndexPID)    =   B10(IndexPID);//Same - Father code
           
LF_B11(IndexPID)    =   B11(IndexPID);//Same - Mother Code
           
LF_B12(IndexPID)    =   B12(IndexPID);//Same - is the person is respondent


           
writecase(ELIGIBAL_FEMALE_DICT);//Write case in extrnal dictionary
           
inc(IndexPID);

        else
            inc
(IndexPID);
        endif;
                inc(IndexPID);

    enddo;
                // close(ELIGIBAL_FEMALE_DICT);
               
close(ELIGIBAL_FEMALE_DICT);

An example: Synchronize the file from one tablet to another tablet through Bluetooth.
if loadsetting("Designation")="2" then
       
                If  syncserver
(Bluetooth, "..") then   // Get the Assigned Household from the Supervisor
                   
syncdisconnect();
            errmsg ("The assigned households are received.");
                   
                    stop(1);
                else
                endif
;

        elseif loadsetting("Designation")="1" then
                if syncconnect
(Bluetooth) then  // Send the Assigned Houesholds to the Enumerator
                   
syncfile(PUT, "..\106_Ext_Data\PRN-" + edit("9999",PSU_ID) + ".csdb", "/106_Ext_Data/");
                    syncdisconnect();
            errmsg ("The assigned households are forwarded to the enumerator.");
   
                else
               
                endif
;
       
        endif;

Hope it works for you.
a.
Attachments
Eligibal_Female.rar
(1.79 KiB) Downloaded 442 times
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

Re: MENU APK

Post by segxy4manu »

Thanks as usual A.
you have always been an SOS.
I will explore and revert soon.
I hope it work fine for me

thanks
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

Re: MENU APK

Post by segxy4manu »

From the above code shared
please which variable am i going to place it?
is it inside the processing_code app and which of the variable ?
the Section F here is not cleared to me.

Thanks
S.
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: MENU APK

Post by khurshid.arshad »

Feel free to incorporate this logic at the end of the roster. This ensures that once you've completed the roster, the corresponding file will be generated.
a.
Post Reply