Entry according to number of household

Other discussions about CSPro
Forum rules
New release: CSPro 8.0
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Entry according to number of household

Post by josh »

And what happens when you try the code that uses currocc?

Really the roster control is the simplest solution though. I'm not sure why you don't want to use that.
MrTaco
Posts: 128
Joined: November 18th, 2014, 1:55 am

Re: Entry according to number of household

Post by MrTaco »

The issue is that if I use a roster control, it won't work coz all the questionnaires are not having the same number of people in the household.

when i use the code it says " Compile failed" on the Logic View
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Entry according to number of household

Post by josh »

The occurrence control field of the roster lets you have a different number of rows in the roster for each questionnaire. You create a variable in your dictionary for number of people in the household and set that variable as the occurrence control field. Then when keying in a household you enter the number of people for that household and the number of rows of the roster is adjusted automaticaly.

On the compile error, this probably a typo or a missing semicolon or something. Check the spelling of curocc(). I often put in the wrong number of r's or c's.
MrTaco
Posts: 128
Joined: November 18th, 2014, 1:55 am

Re: Entry according to number of household

Post by MrTaco »

Hi Josh

Can you please add the code for me

find the attached file

Thanks
Attachments
Restricted Household Roster.zip
(3.47 KiB) Downloaded 398 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Entry according to number of household

Post by josh »

Here are the two options - with occurrence control field and with logic.
Attachments
Restricted Household Roster - logic.zip
Version using if and curocc() in logic (look at proc for race)
(3.83 KiB) Downloaded 430 times
Restricted Household Roster - occurence control field.zip
Version using occurence control field (look at roster properties)
(3.73 KiB) Downloaded 444 times
MrTaco
Posts: 128
Joined: November 18th, 2014, 1:55 am

Re: Entry according to number of household

Post by MrTaco »

Thank you Josh...

That's what I wanted
mclaren11
Posts: 10
Joined: November 20th, 2016, 11:31 am

Re: Entry according to number of household

Post by mclaren11 »

I'm not certain I comprehend what you are attempting to do precisely. Is every line of the list a man or a family unit? Is it true that you are attempting to confine the quantity of lines in the list? On the off chance that that is the situation then you might need to take a gander at utilizing the "occurence control field" in the list properties. To utilize right tap on the list and pick properties and under event control field enter the name (not name) of a variable in the word reference that will be filled in before you get to the list. CSPro will set the quantity of lines in the program to the estimation of this variable. For instance in the event that I have a variable NUMBER_OF_PEOPLE_IN_HOUSEHOLD on my frame before the list of family individuals then I could utilize this as the event control field.
miyinzi
Posts: 1
Joined: September 11th, 2016, 5:36 am

Re: Entry according to number of household

Post by miyinzi »

Dear Good People,

Can someone share a code that will enable me to implement a dynamic loop such that if a household has five members, only five rows appears and so on. Thanks. :)
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: Entry according to number of household

Post by aaronw »

Take a look at the example projects Josh has already provided that demonstrate how to restrict the number of rows shown in a roster. One uses logic and the other uses a property called the occurrence control field.
Post Reply