Hello community.
I need to ask how many buildings there are in a school and for each building, fill in the same questions.
what the number of buildings of school? nr_buildings
if nr_buildings = 3
run loop 3 times with the same questions:
q1
q2
q3
q4
q5
end loop
Has anyone implemented this in cspro? what is the best way to receive the value in a variable and make the loop bringing the same questions to each building?
Best
FOR loop
-
- Posts: 1793
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: FOR loop
Typically you'd create a record for these building questions and then make the record repeat: https://www.csprousers.org/help/CSPro/occurrences.html
The NR_BUILDINGS value would not be on the repeating building record, as you're only asking that once. Then in Q1, you'd have a check, something like:
The NR_BUILDINGS value would not be on the repeating building record, as you're only asking that once. Then in Q1, you'd have a check, something like:
PROC Q1
preproc
if curocc() > NR_BUILDINGS then
endgroup;
endif;
preproc
if curocc() > NR_BUILDINGS then
endgroup;
endif;
Re: FOR loop
Hi Gregory,
I already implemented your suggestion in tests and now works fine.
Thanks a lot.
I already implemented your suggestion in tests and now works fine.
Thanks a lot.