Page 1 of 1

PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: December 26th, 2020, 5:47 pm
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.

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: December 27th, 2020, 12:05 pm
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.

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: December 27th, 2020, 6:44 pm
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

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: December 28th, 2020, 6:51 am
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.

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: December 28th, 2020, 11:08 am
by lmoriba
Thanks,

Khurshid Arshad many thanks for your wonderful and timely interventiom. Your observation is correct.

Re: How to load village names into string variable name

Posted: January 19th, 2021, 1:13 pm
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

Re: PREFILL NAMES ROSTER FROM PRELOADED LOOKUP FILE

Posted: January 19th, 2021, 1:27 pm
by josh
Take a look at the example in the workshop lessons on the resources page: https://www.csprousers.org/resources/