Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problem with if in scripting

hi,

i have this if structure in my qvd generator qvw file

if vAction=0 then

     if ...

     else

     .....

     End If

     if......

     else

     end if

End if

if vAction=-1 then

     if ...

     else

     .....

     End If

     if......

     else

     end if

End if

let's will said that vAction=-1, it should jump to the second condition but i don't know why it's continuing in the else inside the false condition (3rd line in example structure)

i've checked the code and the structure a lot of times but i cant find why it happening this...

what could be the problem??

1 Solution

Accepted Solutions
Not applicable
Author

switch vAction

case 1

script

case -1

script

default

script

end switch

Fabrice

View solution in original post

6 Replies
MK_QSL
MVP
MVP

Use if vAction -=1 then

Not applicable
Author

hi Manish i'm using it already,

flipside
Partner - Specialist II
Partner - Specialist II

What you have is two completely separate Nested If statements, so it is working correctly. Your line three is running when Lines 1 and 2 have evaluated false and because it is an else statement runs for any value not already caught by lines 1 and 2. Depending on what you need to do, you need to re-structure your statements.

flipside

Not applicable
Author

Carlos,

Are you sure about the value of vAction ? You can nest several if statements without any problem.

Did you trace it through the debugger ?

Fabrice

Not applicable
Author

hi flipside,

i need to run several if conditions depending of a bigger condition (vAction) something like a case statement

simplifying the question...

how i could do a case statement in Qlikview?

Not applicable
Author

switch vAction

case 1

script

case -1

script

default

script

end switch

Fabrice