lookup

Discussions about CSEntry
Post Reply
paridadeep295
Posts: 20
Joined: July 12th, 2014, 12:54 pm

lookup

Post by paridadeep295 »

Dear All,

i want to show my lookup file(household roster) in my pregnant woman questionnaire. please suggest how to do it.

Thanks in advance.

Dilip
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: lookup

Post by josh »

It depends on how you want to show the lookup file. Generally you will use loadcase() to load the data from the lookup file and copy it into the appropriate fields of the roster. You will probably need to use a do loop to do this. You can see some examples of working with lookup files at http://teleyah.com/cspro/DCJune2015/05- ... -entry.pdf
paridadeep295
Posts: 20
Joined: July 12th, 2014, 12:54 pm

Re: lookup

Post by paridadeep295 »

Dear Josh,

am almost done with loadcase but that is not working with my program. please look at attached program it will great help if guide me how to do this below step.

i have to enter 1st household questionnnaire with entry menu. then autometic create a lookup .dat file with roster variable as village,structure number,household number, hhid,name,gender and age etc.

then i have to load that lookfile file into the adolscent prg. and i have to enter adolscent girl id from roster variable in adolscent program. but problem is my lookup data not loading with adolscent program.

Please help thanks in advance.

Regards
Dilip
Attachments
Main Survey Menu.zip
Entry Menu, household and adolscent girl prg for problem solve
(59.75 KiB) Downloaded 386 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: lookup

Post by josh »

Please point me to the application and proc where you create the lookup and the application and proc where you try to use the lookup. Specify the filenames and line numbers if possible. I don't know which one is the adolescent program.
paridadeep295
Posts: 20
Joined: July 12th, 2014, 12:54 pm

Re: lookup

Post by paridadeep295 »

Dear Josh,

Thank you very much for your quick response.

am creating lookup in SJRIHH application that lookup create logic there in postproc SJRIHH_QUEST.

am trying to use that lookup in SJRIAG Application and that variable name AGID lebele is "For select adolscent girl id from roster"

Regards
Dilip
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: lookup

Post by josh »

The problem could be that the AG_roster dictionary in the SJRIAG application expects a record type in column 1 but when you write the lookup you write the village number in the first column. The quick fix for this is to remove the record type from the AG_roster dictionary by setting its length to zero. You don't need a record type if your dictionary only has a single record since the only function of the record is to distinguish one record from another.

The better fix would be to use the external dictionary and writecase() in the SJRIAG application instead of using filewrite. You would add the same AG_roster dictionary to both applications (the same file on disk). This way you will not have to worry about the column positions in the filewrite not matching the positions in the dictionary. To use writecase you would change the setfile to use the dictionary name (AG_ROSTER_DICT) instead of the file variable and then for each case, you fill in the dictionary variables in the lookup file dictionary and call writecase passing it the dictionary name and the id items. Something like:
    setfile(AG_ROSTER_DICT,rosterData1, create);
    
    
for ctr in HH_ROSTER000 do
        
        VILLAGE_AG = village;
        STRU_AG = stru;
        HH_NO_AG = HH_NO;
        Q2_9_1_AG = q2_9_1;
        Q2_9_2_AG = q2_9_2;
        
// do same for other variables Q2_9_3...
        if writecase(AG_ROSTER_DICT, VILLAGE_AG, STRU_AG, HH_NO_AG) <> 1 then
            
errmsg("Error writing to lookup file %s", rosterData1);
        
endif;
    
enddo;
I also noticed that the path to the roster lookup file that you are using (..\..\SJRI\Main Survey Menu\Roster\) does not match the file structure of the applications that you sent me. This may be just the way that you put the applications into the zip file but if you are still having problems you may need to double check this.
paridadeep295
Posts: 20
Joined: July 12th, 2014, 12:54 pm

Re: lookup

Post by paridadeep295 »

Thank you very much josh :)

that problem is in "AG_roster dictionary in the SJRIAG application expects a record type in column 1 but when you write the lookup you write the village number in the first column".

now working correctly.

Thanks again.

Regards
Dilip
Post Reply