Page 1 of 1

How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 23rd, 2018, 7:54 pm
by lmoriba
Dear CSPRO community,
I was able to design a menu which handles pre assigned clusters to an interviewer. So that when an interviewer Logs In with an assigned ID say, 11001, IDs in the identification panel like Area, LGA and Cluster are automatically prefilled, depending on the assigned cluster.
My Problem:
I created another lookup file which has Cluster number, household number, names of Household Heads and their contact telephone numbers. So when you enter any Household Number:
1. Check if the Household Number is found in the list of Household Numbers assigned to that Cluster. If the household Number is not found display appropriate error message.
2. If found, prefill, the name of the Head of household and Telephone Number from lookup corresponding to the already entered household number in the assigned Cluster.
Am stuck with no idea how to proceed, I need help urgently. I have attached my application, together with the look up file in excel. The lookup file is called ClusterHouseholdNumber
GMLFS2018.zip
(1.73 MiB) Downloaded 305 times

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 24th, 2018, 6:49 am
by khurshid.arshad
Dear
Please use this syntax.

Code: Select all

PROC HH2

	setfile(ASSIGNED_CNUM_HHNUM_DICT,"..\Data\AssignedClusterHholds.csdb");

	CLUSTER_NO=HH1;
	HHNO=HH2;

	loadcase(ASSIGNED_CNUM_HHNUM_DICT) ;
	HH5_1 = HHEAD;
	HH5_2_1 = TEL_COMMENT;

Best.
a.

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 24th, 2018, 10:58 am
by lmoriba
Dear Khurshid Arshad,
Many thanks for the suggested coding. However, it didn’t work. Remember, my problem is to prefill the Name of the of the head of Households and the contact telephone number which variables are HH5_1 and HH5_2_1, respectively from the LookUp file. The clusterNumber HH1, is automatically filled from system parameter. The household Number is being entered manually. After entering Household number, I want the Cluster Number and Household number to be checked in the lookup file and the corresponding name of the household Head and telephone to filled into HH5_1, HH5_2_1.

Now I tried a slight variation of the of your suggested coding in the preprocs of HH5_1, HH5_2_1, respectively as follows but that too didn’t work.
PROC HH5_1
onfocus
setfile(ASSIGNED_CNUM_HHNUM_DICT,"..\Data\AssignedClusterHholds.csdb");

//CLUSTER_NO = HH1;
///HHNO = HH2;
if LOADCASE(ASSIGNED_CNUM_HHNUM_DICT) = 1 then
if HH1 =CLUSTER_NO and HH2 = HHNO then
HHEAD = HH5_1;
endif;
endif;

PROC HH5_2_1
onfocus
setfile(ASSIGNED_CNUM_HHNUM_DICT,"..\Data\AssignedClusterHholds.csdb");

//CLUSTER_NO = HH1;
///HHNO = HH2;
if LOADCASE(ASSIGNED_CNUM_HHNUM_DICT) = 1 then
if HH1 =CLUSTER_NO and HH2 = HHNO then
TEL_COMMENT= HH5_2_1;
endif;
endif;

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 25th, 2018, 2:49 am
by lmoriba
Dear CSPRo community,
I am still in need of help to this issue posted above am unable to resolve, asap.


Regards,

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 25th, 2018, 7:56 am
by Gregory Martin
If you want to look up a specific case in a file, then you have to call loadcase with parameters. I didn't download your file, but based on the code posted, I would imagine that you would want to do something like this:
CLUSTER_NO = HH1;
HHNO = HH2;

if LOADCASE(ASSIGNED_CNUM_HHNUM_DICT, CLUSTER_NO, HHNO) = 1 then

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 25th, 2018, 12:44 pm
by lmoriba
Dear Gregory,

I tried implementing the coding you suggested but still confused. This is how I implemented it:

PROC HH2



setfile(ASSIGNED_CNUM_HHNUM_DICT,"..\Data\AssignedClusterHholds.csdb");

CLUSTER_NO = HH1;
HHNO = HH2;

if LOADCASE(ASSIGNED_CNUM_HHNUM_DICT,CLUSTER_NO, HHNO ) = 1 then

HH5_1=HHEAD;
HH5_2_1 = TEL_COMMENT;

endif;

I will appreciate any assistance.

Thanks in advance.
GMLFS2018.zip
(1.94 MiB) Downloaded 285 times

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 25th, 2018, 12:56 pm
by khurshid.arshad
just remove onfocus from

Code: Select all

PROC HH2
a.

Re: How to Prefill the Name of Household Head and telephone Number from a lookup file

Posted: June 25th, 2018, 2:02 pm
by lmoriba
Dear Kurshid, Gregory,

Many thanks for your suggestions and assistance. Am happy to inform you that issue is now resolved. I found your hints and suggestions immensely helpful.

Thanks once again,!!
:D