Page 1 of 1

Give a number of reason

Posted: March 24th, 2022, 11:36 pm
by sham
Hi Family,
Senario1
I have Have 2 records
Record1(More record) has the following question.

q1. How many Communities are connected to the electricity?
q2.Mention the name of Community1
q3.Mention the name of Community2
q4.Mention the name of Community3
q5 Mention the name of Community4
q6.Mention the name of Community5

My problem now is is there a ways to restrict q2 to q6 base on the number given in q1 and others will be skied.
so for example. if in q1. the answer is 2. then q2 and q3 only should appear for the enumerator to answer so that q4 ,q5 and q6 will be skipped?

Senarion2
Record 2 is about NHIS. also has the following question
q1. Have you ever registered for the NHIS
q2. State your reason1
q3. State your reason2
q4. State your reason1

Can someone help me with logic such that if the respondent only gives you 1 reason. after answering for q2, at question 3 if you swipe the field as blank, the program should skip q4.?
I attached the file for your study.
I will be glad to get a feed back.
Thank you.
Sham.

Re: Give a number of reason

Posted: March 25th, 2022, 11:09 am
by sherrell
Hi Sham,

For your first Q, just skip out when you hit the max. You don't have a valueset defined for your first question (how many communities can be connected to electricity). So, I don't know if you are allowing zero. If so, then skip out right away from that question. Otherwise, in the preproc of each text-based question (which I would make as an item that repeats rather than stand-alone text items, as then you don't have to repeat logic), you would just say

Code: Select all

PROC Q3
preproc
  if Q1 <= 1 then skip to NHIS_REG; endif;  // repeat this logic for Q4-Q6, with the comparison now being to 2, 3, and 4
For your second block, you should add logic to the postproc such that as soon as the blank string is entered, you exit the block (again, I would make this a repeating item so you don't have to repeat logic)

Code: Select all

PROC REASON1
postproc
  if length($)=0 then skip to <YourNextVar>; endif;   // if you don't have another variable, then just endlevel to close the case.
Sherrell

Re: Give a number of reason

Posted: March 27th, 2022, 11:05 pm
by sham
Hi Sherrell,
Thank you so much.
I appreciate your time and your comment was very useful.

Thanks