Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
therealdees
Creator III
Creator III

Continue "or/and" condition in the next line?

Hi,

 

This must be a stupid question, but I get a syntax error (in script page) when breaking the line in a "or"/"and" condition, for e.g:

[This doesnt work]

If x > y or

  z > x Then

End If

 

[This works]

If x > y or z > x Then

End if

 

Do I need a special char? Like "_" in VBA, for instance..

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi, 'IF' used as control statement needs to have each clause in the same line: https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptCont...

As a workaround you can use a variable to store 1 or 0, here the If() is a function that can use multiple lines, and use this variable in the IF, something like:

LET vCheckConditions = If(x > y or
                            z > x
                         , 1, 0);

IF $(vCheckConditions)=1 THEN

 

View solution in original post

2 Replies
rubenmarin

Hi, 'IF' used as control statement needs to have each clause in the same line: https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptCont...

As a workaround you can use a variable to store 1 or 0, here the If() is a function that can use multiple lines, and use this variable in the IF, something like:

LET vCheckConditions = If(x > y or
                            z > x
                         , 1, 0);

IF $(vCheckConditions)=1 THEN

 

therealdees
Creator III
Creator III
Author

Thank you very much. This will work.