Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have a load script that I used to change the text in a field to a different text based on the Question number. This says that if the value of QuestionNumber 25 is 'Yes', change it to ;No' and vice versa.
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes','No', CResponse),'No','Yes', CResponse) as Response;
How do I add another IF statement to say for QuestionNumber 26, if there is a 'No' response say 'Yes', but if there is a 'Yes' response, leave it as 'Yes'
I tried the below but it didn't work.
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes','No', CResponse),'No','Yes', CResponse) AND IF(Match(QuestionNumber, 26), Pick(Match(CResponse,'No', CResponse), 'Yes', CResponse) as Response;
I tried connecting two IF statements with a comma instead of 'AND' but that did not work either.
Any help is appreciated!
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes','No', CResponse),'No','Yes', CResponse),
IF(Match(QuestionNumber, 26), Pick(Match(CResponse,'Yes','No', CResponse),'Yes','Yes', CResponse),
'no 25 or 26'
))
as Response
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes','No', CResponse),'No','Yes', CResponse),
IF(Match(QuestionNumber, 26), Pick(Match(CResponse,'Yes','No', CResponse),'Yes','Yes', CResponse),
'no 25 or 26'
))
as Response
Not sure, if you need this.
This may be:
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes', 'No', CResponse),'No','Yes', CResponse), IF(Match(QuestionNumber, 26), Pick(Match(CResponse,'No', CResponse), 'Yes', CResponse), CResponse)) as Response;
Thanks Massimo! However, it gives the value as 'no 25 or 26' for the whole column. I think it is because we are saying 'no 25 or 26' before the double brackets in the end.
I tried:
IF(Match(QuestionNumber, 25), Pick(Match(CResponse,'Yes','No', CResponse),'No','Yes', CResponse),
IF(Match(QuestionNumber, 26), Pick(Match(CResponse,'Yes','No', CResponse),'Yes','Yes', CResponse),
CResponse)) as Response;
and this worked!!
Thanks for your help.
Awesome
I suggest closing the thread by marking a correct answer.
Best,
Sunny
I don't know what did you want for
not 25 and not 26
so I typed a constant 'no 25 or 26' to be replaced
Hi Infock12
Please close the thread by selecting Correct Answer and Helpful. Thank you.
I Understan. Thanks M!
Thanks Sunny, Krishna and Qlikviewwizard!