Creating an automatic Loop for a table data

Hi team,

I am developing a survey with complex tables for collecting household data
such as name, gender, age, responsibility and income for each and every
household member.

So for easy development i have broken the survey into simple questions are
one after the other. The 1st question is How many persons live in this
household?, then depending with the response, the system should loop the
number of times entered. For example if 5 is the number of people entered
to be living in a household, then the survey should automatically loop five
times each times allowing the interviewer to enter the name, age,
responsibility and income until information on all household members are
collected.

Any suggestion on how to set the automatic loop in xlsform.

Thanks.

Collins