Can auto code?

Hi,

I have two select  question Q1 and Q2 (single select both).
Q1 have 3 select: 1.A, 2.B and 3.C
Q2 have 2 select: 1.D and 2.E

If Q1=1 auto code Q2=1
If Q1=2 auto code Q2=2
If Q1=3 auto code Q2=2
If skip Q1 auto code Q2=2

my issue when skip Q1 I cannot auto code to Q2=2.

Thanks and sorry for my  weak English,
Vanna
You can use Not(Shown(Q1)) as the condition when defining Q2 when Q1 is skipped.
And you can set Q2=2 by default using SetValue and only apply the Q1=1 condition which is a tidy way to do it.

This probably isn't the most elegant solution, but one way to do this would be to set Q2 to 2 inside the skip logic that skips past Q1.  For example, this skip logic:

```Age < 18
```

Could be turned into this skip logic:

```Begin Unverified Perl
if (GETVALUE('Age') < 18) {
SETVALUE('Q2', 2);
return 1 == 1;
}
End Unverified
```

If you tell me the logic used that skips Q1, I can create the Perl code you need.
answered Oct 12, 2016 by Platinum (153,000 points)
Hi, Zachary

This is my logic skips Q1: Q7_c1<>6 And Q7_c1<>7 And Q7_r6_c2=0 And Q7_r7_c2=0 And Q7_r6_c3=0 And Q7_r7_c3=0

Regards,
Vanna
I believe this skip logic should do the trick:

```Begin Unverified Perl
my \$skip = (GETVALUE('Q7_c1') != 6) && (GETVALUE('Q7_c1') != 7);
\$skip = \$skip && (GETVALUE('Q7_r6_c2') == 0);
\$skip = \$skip && (GETVALUE('Q7_r6_c3') == 0);
\$skip = \$skip && (GETVALUE('Q7_r7_c2') == 0);
\$skip = \$skip && (GETVALUE('Q7_r7_c3') == 0);

if (\$skip) {
SETVALUE('Q2', 2);
return 1 == 1;
}
End Unverified
```
How to add multiple if conditions?