Visit lock period of the survey

Hi,

I have created four (5) boxes for outcome code (visits) for a survey in SS and those will be used for single time or multiple time depends upon appointment of the respondent.

If the respondent will be agreed by first time visit then the first box will be used by 1 and the survey will be completed. If the respondent will not be agreed with first time visit; but, given an appointment to the interviewer for second visit then the first box will be used by 1 and the second box will be used by 2 and survey will be completed and so on for third and fourth and fifth visits also.

But, should not be more than 5 visits.

How do I lock the visits till 5th visits? I could not found in the Public example for locking the certain visits.

What code/syntax I will be used? The screenshot is attached for your reference.

Thanks,
Sitanshu

Consider making Qnvisits into a multi-select question. This achieves the following:

It allows interviewers to:

  • Tick a box for each subsequent visit
  • Enter visit information on a visit-specific row of your visit roster

It allows you as a designer to:

  • Restrict the number of visits to the answer options available (e.g., “visit 1”, “visit 2”, … , “visit 4”)
  • Avoid creating a roster row title programatically. Instead, each roster row will automatically, without any need for code, have the name of the multi-select options elected.

Hi Arthur,

Thanks for providing a very good and valuable solution which was expecting. But, I want record visit in below order…
1st visit should come first
2nd visit should come after first visit
3rd visit should come after second visit
4th visit should come after third visit
5th visit should come after fourth visit

How do I validate in the script? What syntax I have to use?

Thanks,
Sitanshu

Hi Arthur,

I have developed the solution of my second query in this way which shown below:

1st visit:
Qnvisits.Contains(1) || !Qnvisits.Contains(2)
Error Message:
INTERVIEWER: 2nd visit should come after 1st visit. Remember, same house was visited already before this visit.

2nd visit:
(Qnvisits.Contains(1) || !Qnvisits.Contains(3)) && (Qnvisits.Contains(2) || !Qnvisits.Contains(3))
Error Message:
INTERVIEWER: 3rd visit should come after 1st and 2nd visits. Remember, same house was visited two times already before this visit.

3rd visit:
(Qnvisits.Contains(1) || !Qnvisits.Contains(4)) && (Qnvisits.Contains(2) || !Qnvisits.Contains(4)) && (Qnvisits.Contains(3) || !Qnvisits.Contains(4))
Error Message:
INTERVIEWER: 4th visit should come after 1st, 2nd and 3rd visits. Remember, same house was visited three times already before this visit.

4th visit:
(Qnvisits.Contains(1) || !Qnvisits.Contains(5)) && (Qnvisits.Contains(2) || !Qnvisits.Contains(5)) && (Qnvisits.Contains(3) || !Qnvisits.Contains(5)) && (Qnvisits.Contains(4) || !Qnvisits.Contains(5))
Error Message:
INTERVIEWER: 5th visit should come after 1st, 2nd, 3rd and 4th visits. Remember, same house was visited four times already before this visit.

Are the above syntax fine for validation?

Grateful if you can suggest in a better way.

Thanks,
Sitanshu

Not sure if this is better, but the code is definitely more compact:

Qnvisits.ContainsAll(Enumerable.Range(1, Qnvisits.Max()).ToArray())

The basic idea is this: all tick boxes must be selected from the last visit to the first visit.

Since your visits correspond to options codes with increasingly high values, we can re-express the ideal outcome as an array of answer options from 1 to N, where N is your last visit. From the code above, that is this part: Enumerable.Range(1, Qnvisits.Max()).ToArray().

Since you want all visit options to be ticked, you want: Qnvisits.ContainsAll(...)

Put those together and you have the expression above.

Since all the first visits up to N must be filled out (checked) it is sufficient then to specify just N and have the program do the rest.

This is what the prototype shown on the first screenshot was doing by utilizing a numeric question of number of visits as a trigger for the visits roster. I don’t see what is the advantage of the multiselect in this context.

On the other hand if you know you will need no more than 5 (or any other reasonable number) visits - a combination of a single-select and a fixed roster with condition may be more advantageous, since it will preclude the wrong entries like 22 visits instead of 2 visits (due to a typo).

Best, Sergiy

Hi Arthur,

Thanks for your suggestion. There could be one visit or more than one visits for any interview. If more than one visits then Interviewer should take another appointment from the same respondent for next visit or next to next visits and so on till 5th visits. It’s depends of agreement of the respondent. But, not more than that.

In this situation I want to fix the visits till 5th in the visit roster.

I hope I have explained in the right way.

Please suggest the technicality of writing the syntax (code).

Thanks,
Sitanshu

Hi Sergiy,

Thanks for sharing the info. However, I could not understand about your explanation. But…

"There could be one visit or more than one visits for any interview. If more than one visits then Interviewer should take another appointment from the same respondent for next visit or next to next visits and so on till 5th visits. It’s depends of agreement of the respondent. But, not more than that.

In this situation I want to fix the visits till 5th in the visit roster.

I hope I have explained in a right way.

Need your assistance about the technicality of writing the syntax (code)."

Thanks,

Sitanshu