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

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

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

Post 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 302 times
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

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

Post 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.
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

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

Post 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;
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

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

Post by lmoriba »

Dear CSPRo community,
I am still in need of help to this issue posted above am unable to resolve, asap.


Regards,
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

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

Post 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
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

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

Post 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 282 times
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

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

Post by khurshid.arshad »

just remove onfocus from

Code: Select all

PROC HH2
a.
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

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

Post 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
Post Reply