Validating the options selected in one multiselect question should be included in another multiselect question

hello,
suppose I have one multiselect question that has 20 options, among them 8 were selected.
again another multiselect question having same options.

now those 8 options selected in 1st questions must be selected in 2nd question. how do I write validation condition for this?

Do you mean that the answer to Q2 should always be exactly the same as answer to Q1?
Then what is the point in asking Q2?

there will be few more options in Q2 … Q1 will have option 1 to 18 but Q2 will have option 1 to 24 with first 18 option being same as Q1. so the options selected in Q1 must be included in Q2 without using filter

suppose the response of Q1 is (1,3,5,6) now Q2 must include those response (1,3,5,6) along with option to include others like (1,3,5,6,2,8)

This is possible, but typically done the other way around. For example,

"Q1: On which days did you work last week?" + 7 choices:
Monday, Wednesday, Friday.

"Q2: On which of these days did you work UNTIL LATE last week?" + 3 choices:
Monday, Friday

What is your real situation? Can you post the page from your actual questionnaire to illustrate?

Q1: Which of the following sports did you played from September 1 to September 7?

  1. Football
  2. Cricket
  3. Basketball
  4. Rugby
  5. Baseball
  6. Tennis
  7. Badminton

response : 1,3,6

Q2: Which of the following sports did you played from September 1 to September 14?

  1. Football
  2. Cricket
  3. Basketball
  4. Rugby
  5. Baseball
  6. Tennis
  7. Badminton

response : 1,3,6,2,7

as you can understand the response from Q1 must be included in Q2 also.

Yes, Yubraj, the example that you show is exactly the case that I describe above.

I have added an example section “Sports played” to the public questionnaire:
"Public example User questions and common patterns", which demonstrates the approach I would recommend in this case.

What you originally intended to do is possible to check in Survey Solutions with a single line of code, but the usability of that questionnaire will be low.

In general follow this rule: if you know the answer to the question, you should not be asking it and demanding that particular answer.

Reversing the posted example to your situation, your second question could have been “Q2: in addition to the earlier mentioned sports, did you play any of the following in the week September 8 to September 14?” and show only not selected options from Q1.

See also section “Tourism Seasons” in the same questionnaire for relevant techniques.

yes. I could use the filter in Q2 saying, display only the options not selected in Q1. But that would mean I will have to edit the data later on after the completion of survey, pasting the response of Q1 on Q2.

yes. and if there is any situation where there is a tradeoff between the convenience of the questionnaire designer/hq user and the interviewer - prefer the convenience of the interviewer.