When providing sample surveys, please only include the relevant questions. The volunteers giving help here do not have time to go threw a bunch of survey questions only to find that they have nothing to do with the problem.
Expression Manager uses question/sub-question/answer
codes, not the labels.
You can test whether any row in the array is answered with one of the first two items with an equation like this:
Code:
sum(countifop("==", 'K2K01', that.K2), countifop("==", 'K2K02', that.K2)) > 0
This effectively says return a sum of all of the K2 sub-questions having an answer equaling "K2K01" or "K2K02".
Please refer to the Expression Manager documentation for available functions -
www.limesurvey.org/manual/Expression_Man...#Access_to_Functions
So, the Question validation
equation for the comment question could be like this (line-breaks inserted for clarity):
Code:
(sum(countifop("==", 'K2K01', that.K2), countifop("==", 'K2K02', that.K2)) > 0 AND !is_empty(K2Kom))
OR
sum(countifop("==", 'K2K01', that.K2), countifop("==", 'K2K02', that.K2)) == 0
And, the Question validation
tip could be like this (line-breaks inserted for clarity):
Code:
{
if(
(sum(countifop("==", 'K2K01', that.K2), countifop("==", 'K2K02', that.K2)) > 0 AND !is_empty(K2Kom))
OR
sum(countifop("==", 'K2K01', that.K2), countifop("==", 'K2K02', that.K2)) == 0,
'Valid',
'Invalid!'
)
}
Sample survey attached: