PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

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

PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by lmoriba »

Dear CSPRO Community,


I need urgent help. Am trying to prefill a roster from a lookup table, i keep getting an error message, Error(13): "Invalid function call(Multiple Record/Group/Block/Item name expected" as seen in the attachment.

I can't seem to figure out what is wrong with this syntax. I want the ID number and names to be prefilled from an earlier survey data. This is my coding. However, am not sure, if this is the way to go about.

preproc

if loadcase(PES_PRELOAD_DICT, A1,A2,A3,A4,A5,A6,A11A ) <> 1 then
errmsg("Household not found in preload data file");
stop(1);
endif;


// Prefill in names in names roster from enumerator data file
numeric numPreloadIndividuals = count(PES_PRELOAD_DICT.PES_PRELOAD_REC);

do numeric i = 1 while i <= numPreloadIndividuals

P0(i) = IDNO_PLR(i);
P1(i) = B1_PRL(i);

do
enddo;
PES_main2712.zip
Attached is the application.

Thanks in advance.
Last edited by lmoriba on December 27th, 2020, 6:50 pm, edited 2 times in total.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by josh »

As the error says, count only works on records that have multiple occurrences. The record PES_PRELOAD_REC is required and has max to set 1 in the dictionary so it cannot have multiple occurrences. In other words, count will be always equal to 1 so there is nothing to count. Your probably should set the max for that record to something greater than one (the maximum number of individuals in a household). However, this assumes that the data file is structured in such a way that you really do have multiple records in each case.
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by lmoriba »

Thanks Josh for this useful suggestion. The application compiled. However, I was expecting five household members to be prefilled but only one household member got prefilled. Therefore, am once more sending you my application with screen shots: sending my application
Attachments
PES_main2712 .zip
(257.36 KiB) Downloaded 184 times
Capture3.JPG
Capture3.JPG (100.82 KiB) Viewed 2851 times
Capture2.JPG
Capture2.JPG (83.93 KiB) Viewed 2851 times
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by khurshid.arshad »

You have only one case against each unique id. For instance;

Unique Id is : 11B0110121212{1} This is your First household id
Name is : MAMOILETSI CHALO

Unique Id is : 11B0110121212{2} This is your Second household id
Name is : NOSI MAKATJANE

That is why you getting only one name.

Your File conversion from Excel to CSPro is not good. Re-run the Excel to CSPro or use attached file


a.
Attachments
PRELOAD_A.rar
(29.96 KiB) Downloaded 187 times
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by lmoriba »

Thanks,

Khurshid Arshad many thanks for your wonderful and timely interventiom. Your observation is correct.
langsonb
Posts: 4
Joined: December 3rd, 2020, 1:38 pm

Re: How to load village names into string variable name

Post by langsonb »

Hi,

I am new to cspro. I have a dictionary with district_code oof 3 numeric characters. I also have a village name of 50 characters. I created an external file with district code, village code and village name.
My question is how can I display villages belonging to a particular district? I do not want to store code in the village name?

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

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Post by josh »

Take a look at the example in the workshop lessons on the resources page: https://www.csprousers.org/resources/
Post Reply