Loop

Discussions about CSEntry
Post Reply
BK Singh
Posts: 18
Joined: April 11th, 2023, 11:13 am

Loop

Post by BK Singh »

Dear sir/mam,
I have a HouseHold roster with question Q1-name, Q2-sex, Q3-age and out of roaster I have Q5- Respondent age is to be entered. I need a logic which will check the age entered in Q5 is matching with any age entered in Q3 if not then errmsg should appear.
I am trying creating loop but the errmsg appears for every occurrence of Q3 which is not equal to the number entered.
Logic:-
do i = 1 while i <= Q3(i)
if Q5<>Q3(i) then
errmg(",,,,,,,");
endif;
endo;
etuser
Posts: 86
Joined: September 3rd, 2019, 5:57 am

Re: Loop

Post by etuser »

may be

if not Q3 has Q5 then
errmsg (".....");
endif;
BK Singh
Posts: 18
Joined: April 11th, 2023, 11:13 am

Re: Loop

Post by BK Singh »

thank you sir...
But is there any other way
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Loop

Post by khurshid.arshad »

Dear;

I've developed an app that works for two different items, Q4 and Q8. Q4 is for entering the age of household members and Q8 is for finishing entering members.

In Q4, when you enter the age, the app compares the name from Q2 and R_Q1. If they match and the age in Q4 and R_Q2 don't match, an error message pops up with two options. You can amend the age either in Q4 or R_Q2, based on your selection.

The second block of code is for Q8. When you finish entering members, the seek function searches for the respondent's name in the roster. If it's found, nothing happens. If it's not found, the do-while loop shows a list of members with two options: 1) Edit respondent name; 2) Add another member.

If you select a name from the list, you can edit the name. If you select the second last option, you can edit the respondent name in R_Q1. If you select the last option, you can add another member to the roster for the respondent. I hope this app works well for you!

Best.
a.
Attachments
Application.rar
(12.74 KiB) Downloaded 81 times
BK Singh
Posts: 18
Joined: April 11th, 2023, 11:13 am

Re: Loop

Post by BK Singh »

Dear Arshad.Khursheed sir,
I have watched all you youtube videos. Can you please make a detailed video on types of loop.
Thank you
BK Singh
Posts: 18
Joined: April 11th, 2023, 11:13 am

Re: Loop

Post by BK Singh »

by the way thank you for the help
Post Reply