Combined logic in survey

Hi everyone,

I am trying to combine multiple logics in blocks of two. In other words, I’d like a question to display only if:

(VAR1 and VAR2 take certain values) OR (VAR2 and VAR3 take certain values) OR (VAR1 and VAR3 take certain values)

How can I do this? It seems to me that logics would only work with every two, i.e., like this:

{VAR1} <> ‘Column 1’ and {VAR2} <> ‘Column 4’

Thank you for any help you may be able to offer.

I assume you’ve tried brackets already.

My next approach would be to use some hidden expressions for each pair to simplify the final logic.

Thanks. Not only that, but any combined logic does not work. Neither within the same matrix nor if spread out across different questions:
{question1.Row 1} = ‘Column 2’ and {question1.Row 2} = ‘Column 2’

It only works if single:
{question1.Row 1} = ‘Column 2’

Please try editing the survey URL to 2024.1.0 from 2024.2.0 in case that helps.

Thanks, it does. And parentheses work for combined logic, too:

({question1.Row 1} = ‘Column 2’ AND {question4.Row 1} = ‘Column 2’) OR ({question1.Row 1} = ‘Column 2’ AND {question4.Row 2} = ‘Column 2’)

1 Like

Cool. I need to check but it might be that the combined logic would work in 2024.2.0 if the variables include their block names, e.g.

({block_1/question1.Row 1} = ‘Column 2’ AND {block_1/question4.Row 1} = ‘Column 2’) OR ({block_1/question1.Row 1} = ‘Column 2’ AND {block_1/question4.Row 2} = ‘Column 2’)

2024.2.0 does not seem to recognise booleans at all, at least for me. Only single logic works.

For reference, I have tried it on a different survey, a more complex one, and 2024.1.0 does not work for combined display logics.

Here is a survey which works (used different code) in both versions

https://run.pavlovia.org/pavlovia/survey-2024.2.0/?surveyId=446ace7c-1b82-41b9-abad-e95a1ee59ce9

https://run.pavlovia.org/pavlovia/survey-2024.1.0/?surveyId=446ace7c-1b82-41b9-abad-e95a1ee59ce9

If you have a survey that doesn’t work in 2024.1.0 but only contains a single block, please could you elaborate so I can test?

Thanks. This is the one I am struggling with. I am trying to show ‘Briefing 1’ to those who get at least 2/3 attention checks right and ‘Briefing 2’ to those who do not.

‘Briefing 1’:
({Adjectives 4.Row80} = ‘Column 1’ AND {Hexaco 4.Row78 = Column 4’) OR
({Adjectives 4.Row80} = ‘Column 1’ AND {Goals 2.Row31} = ‘Column 3’) OR
({Hexaco 4.Row78} = ‘Column 4’ AND {Goals 2.Row31} = ‘Column 3’)

‘Briefing 2’:
({Adjectives 4.Row80} <> ‘Column 1’ AND {Hexaco 4.Row78 <> Column 4’) OR
({Adjectives 4.Row80} <> ‘Column 1’ AND {Goals 2.Row31} <> ‘Column 3’) OR
({Hexaco 4.Row78} <> ‘Column 4’ AND {Goals 2.Row31} <> ‘Column 3’)

However, ‘Briefing 1’ is always displayed, no matter what, and ‘Briefing 2’ is never.

I’ve extended my demo and discovered that the issue is probably that block_1/ isn’t needed for the very first term in the logic

({question1} = true and ({question2}= false or {question2} empty) and ({question3} = false or {question3} empty) 
or ({question2} = true and ({question1}= false or {question1} empty) and ({question3} = false or {question3} empty) 
or ({question3} = true and ({question2}= false or {question2} empty) and ({question1} = false or {question1} empty) 

works in 2024.1.0 and is switched by question1 only in 2024.2.0

({block_1/question1} = true and ({block_1/question2}= false or {block_1/question2} empty) and ({block_1/question3} = false or {block_1/question3} empty) 
or ({block_1/question2} = true and ({block_1/question1}= false or {block_1/question1} empty) and ({block_1/question3} = false or {block_1/question3} empty) 
or ({block_1/question3} = true and ({block_1/question2}= false or {block_1/question2} empty) and ({block_1/question1} = false or {block_1/question1} empty) 

works in 2024.2.0