Dealing with Nulls in Validation

i need to validate an answer that is linked to an question that wasn’t answered or enabled.

for example a single select question Q2 is enabled by Q1 another single select question

if Q2 is not enabled then its value is null, I have a question Q15 which should only be 8 while Q2 is not answered or null.

What syntax can I use to validate Q15 this ?

neville

null is just a value that you can use in comparisons directly. That said, it is my deep conviction that a question that has only one possible answer should not be asked at all.

I thought I had the solution to my problem but it failed in testing,

For my visitor departure survey We have ask the same question for an activity for two islands,

before each of the following questions I ask if did any leisure activities on each island

Q1a Did you do any leisure activity on island 1? 1Y 2N

1.1a Did you go the beach in island 1
enable Q1a = 1

Q1b Did you do any leisure activity on island 2? 1Y 2N

1.1b Did you go the beach in island 2
enable Q1b = 1

Now I have a question later on about the quality of the beach experience.
Q15 beach Experience
1Excellent
2good
3fair
4Poor
8NA
9NS

My problem comes when I try to validate Q15 when the questions Q1.1a and Q1.1b are never answered because they was no leisure activity. I have validation syntax for answering the beach question however if you say no to the leisure question and so never get to the beach questions. In this case the NA should be chosen.

I am trying to figure out the syntax for Q15 to write to do all this and getting problems.
I currently have the following

(self.InRange(1,4) || self==9) && (1.1a==1 ||1.1b==1) ||
(1.1a==2 && self ==8) || (1.1b==2 && self ==8)
I tried adding the following syntax to the above but everything passes
|| ((!IsAnswered(q1.1a) && (!IsAnswered(q1.1b) && self ==8) )

Can I accomplish this within the validation syntax or should I do it after the data has been exported to something like SPSS?

Hello friend, what kind of questions are q1.1a and q1.1b?

If they are single-categorical selection and have values ​​of 1Y and 2N. If it is the previous case, then it is enough to make a filter to Q15, and you would place:

(q1.1a == 1 || q1.1b == 1) ?
@optioncode < 8 : @optioncode > 4

No, in this case the question on beach experience should be skipped.
There is NO validation that you can attach to the question about experience. It is purely an opinion.

With that option 8 should not be part of q15.
Sergiy