Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

mystery if then else error in script

Hello,

I'm having trouble with if/then/else in a script. I had this working in a different document, but I get script errors now. The exact script below throws the error. If I comment out the If/Endif statement, it runs fine. What am I missing (I know it's something painfully obvious, but I've been searching Google and the forums for ~60 mins with no luck).

Once I solve the "outer" if/then, I need to work on the inner if/then, but one thing at a time!

ifscripterror.gif

Thanks!

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: mystery if then else error in script

Well..... I continued having script gremlins. The debugger and the "normal" reload would intermittently throw "script error: endif" errors. I eventually made this go away by changing to a switch on a boolean:

solved.gif

I think the compiler must do some crazy partial evaluation behind the scenes... hence the sporadic errors with the prior syntax.

10 Replies
Employee
Employee

Re: mystery if then else error in script

Is there any

LET vCount

BEFORE the for "loop"?

Not applicable

Re: mystery if then else error in script

Yes. I LET vCount = 0; before the loop. This was working in the other document I created.

Employee
Employee

Re: mystery if then else error in script

What is the exact error message?

rustyfishbones
Honored Contributor II

Re: mystery if then else error in script

Have you defined the variable for

vTargetOut

Is it looking in the correct directory

Not applicable

Re: mystery if then else error in script

Alan,

I know everything is working apart from the if/then because everything works properly when I comment out the if/then (see below).

noifnoerror.gif

Thanks!

mov
Esteemed Contributor III

Re: mystery if then else error in script

Somehting's wrong with vCount...  What the error is?

Try to run in the debug mode.

Not applicable

Re: mystery if then else error in script

Well.... the error was "Script Error: ENDIF". After several iterations of commenting and uncommenting pieces of the if clause, the script now works. I didn't make any changes to the code itself. This is weird. Here's the working code:

nowitworks.gif

I'll chalk this up to gremlins and proceed with fingers crossed. Thank you for your help!

Not applicable

Re: mystery if then else error in script

Well... as mentioned above, this is now mysteriously working with no code changes. I have no idea what happened!

nowitworks.gif

Thank you for your help, though!

Employee
Employee

Re: mystery if then else error in script

Well...

Maybe because Oct 31 is coming

Community Browser