.setValue
This operator sets the answer option for the specified question. Answer options can be set in several ways; for example:
.setValue(Q(30), 1) // set the answer for QID 30 to option 1 .setValue(Q(40), [1, 3]) // set answer for QID 40 to options 1 and 3 (multicheck) .setValue(Q(50), Q60)) // set answer for QID 50 to whatever the answer is for QID 60 .setValue(Q(70), "Pink") // set answer for QID 70 to "Pink" (text) .setValue(Q(80), "") // clear the answer to QID 80 ("unset" the answer if there is one)
.clearAnswer
.clearAnswer(Q(n)) is, essentially, a wrapper for setValue('') on any given question. It's a little cleaner to use and a bit more intuitive for questions that aren't text-based. Under the hood, it's doing all the same stuff as setValue('').
ifQ(1) .answered() .clearAnswer(Q(11))
ifQ(1) .answered() .clearAnswer(Q(11), Q(21))
ifQ(1) .answered() .clearAnswer(QRange(100,400))
ifQ(1) .answered() .clearAnswer(Section(11))