Showing available mothers in same family roster

Discussions about CSEntry
Post Reply
msoni
Posts: 11
Joined: February 19th, 2024, 11:38 am

Showing available mothers in same family roster

Post by msoni »

Hello
Greetings

We have a household survey to be planned where we will be collecting family members information like name, gender, age etc. There is one more question line number of mother , this line number of mother will be applicable to the members who are less than 5 years entered in age column.

Now I want to make a dynamic value set for the variable, line number of mother. It should show line number and name of the woman who could be possible mothers having age 18 to 46, and who are previously entered in the same family roster.

For example, there is a woman entry in line number 2 and name is A and her age is 40 years, then lets say there is a 4th member details who is less than 5 years. so here i should get pre populated line number and name , (2,A ), in this case as a value set.

If there are more woman in the same category, all should be populated in the dynamic value set. and when selected, the line number of mother should be stored..

Please suggest.
Thanks and Regards
Manoj
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Showing available mothers in same family roster

Post by sherrell »

I'm not quite sure what you want to do. There could be 2+ women in a household who meet your conditions and therefore could be the mother of a child. So you would need to allow the interviewer to choose the correct woman--if she even exists, for she could be dead or living elsewhere.

Also, I'm not sure why you want to go to the trouble of creating a valueset for just one person, rather than just storing the line number and name as separate variables. However, if you want to create a value set with just one entry you can use the example found at the bottom of this page to build the value set and assign it...although you'll still need to figure out who's the right mother (if any):

https://www.csprousers.org/help/CSPro/valueset.html

Sherrell
msoni
Posts: 11
Joined: February 19th, 2024, 11:38 am

Re: Showing available mothers in same family roster

Post by msoni »

Many Thanks

Actually in the family roster, there is question, mother line number which is applicable for the child is less than 5 years. Any member above 5 years, will be skipped this mother line number question

for those who are less than 5, i want to show all female members name and line number in a value set. These member will be from the same roster entered above. These will be all female within the range of 18 to 46, along with their line number. So data collector will choose only one from the value set, otherwise, data collector may commit mistake and enter incorrect line number, if i leave the mother line number field without this check.

I was trying like this but not working. code does not have compile error.

PROC MOTHER_LINE

// preproc
// ask if m_age_y<=5;

Onfocus

numeric numcodes=1;
numeric i;
do i = 1 while i <= totocc(FAMILY_MEMBERS_DETAILS_FORM)
if m_age_y in 18:46 and m_gender=2 then // female with given range
vsFCodes(numCodes) = M_SNO;
vsFName(numcodes) = FULLNAME;
inc(numcodes);
endif;
enddo;

Postproc
if demode()=add then
if not invalueset($) then
errmsg("Please check the value again");
reenter;
endif;
endif;


Please suggest. I can share my application, if required.
Regards
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: Showing available mothers in same family roster

Post by justinlakier »

Hello,

First, find the current line number, such as LINE_NUMBER below. Then loop over all people at lower line numbers, checking if they are potential mothers. If they are, add them to the dynamic value set. You should use the ValueSet object with documentation found here (https://www.csprousers.org/help/CSPro/valueset.html), and should loop only over previous entries in the roster, not totocc(). You also should use the counter variable to index the values at the specific row number you want. Here is an example.
ValueSet potential_mothers;
potential_mothers.add("Not someone previously entered in this roster", 0);
do varying numeric i = 1 while i<LINE_NUMBER
     if m_gender(i)=2 and m_age_y(i)>=18 and m_age_y(i)<=46 then
         
potential_mothers.add(NAME(i), i);
     endif;
enddo;
setvalueset($, potential_mothers);
The label here will be the name, and the line number will be the code, so the selected code will be stored in the current item. You will likely want to alter this to fit your own code.

Hope this helps,
Justin
msoni
Posts: 11
Joined: February 19th, 2024, 11:38 am

Re: Showing available mothers in same family roster

Post by msoni »

Many Thanks
I tried using your suggested code. Again no compile error but no value set is being popped up. I request you to please see my attached application and help.

Code is written on Mother_line proc

Thanks again and regards
Attachments
queryinapp.zip
(28.22 KiB) Downloaded 25 times
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: Showing available mothers in same family roster

Post by justinlakier »

Hello,

Currently the capture type of this question is text. You need to go on the form, right-click on the text box, go to Field Properties and change the capture type of the question to Radio Button in order to see and select from the value set.

Hope this helps,
Justin
msoni
Posts: 11
Joined: February 19th, 2024, 11:38 am

Re: Showing available mothers in same family roster

Post by msoni »

Many Thanks Justin.
This codes showing all available mothers the way, i was looking for.

Regards
Manoj
Post Reply