Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I'm experiencing a problem with QlikView 12 from SR3 to SR6.
Inside SR3, I'm running the following code:
FOR Each vYear in DirList('$(vSourceBacklog)Reports\*')
TRACE Lendo pasta: $(vYear);
FOR Each vMonth in DirList('$(vYear)\*')
TRACE Lendo pasta: $(vMonth);
FOR Each vExport in FileList('$(vMonth)\closed_requests_*.xlsx')
// Some code here
NEXT vExport;
NEXT vMonth;
NEXT vYear;
This runs perfectly fine, but when I open it on SR6 I get the following error:
Semantic error
The control statement is not correctly matched with its corresponding start statement
NEXT vExport
If I click "Ok" on the error message, it goes out of the For Each showing the same error for vMonth and vYear.
The only difference I noticed from both QlikView versions is that inside SR6 script, variables are not gray italic anymore (images attached).
Any thoughts?
That piece of script works fine in QV 12.20 SR7, might be a bug in some versions.
Upgrading QV should resolve the issue
Maybe that version does not like the variable in the end of NEXT.
have you tried just "next"
If i'm not mistaken, it dosen't even need the ";".
FOR Each vYear in DirList('$(vSourceBacklog)Reports\*')
TRACE Lendo pasta: $(vYear);
FOR Each vMonth in DirList('$(vYear)\*')
TRACE Lendo pasta: $(vMonth);
FOR Each vExport in FileList('$(vMonth)\closed_requests_*.xlsx')
// Some code here
NEXT
NEXT
NEXT
In my experience semantic error can also happen sooner than the script error actually occurs (even if it says "occured near next vExport").
Make an alternative app and just run this part of script to be sure it's none of the other next in any other part of the code.
Hello, thanks for the response.
The current version is actually QV 12.20.20700.0 SR6, downloaded today from: https://www.qlik.com/us/try-or-buy/download-qlikview
But the issue occurs on it.
And running on QV12 SR3 or QV11 SR12 goes ok.
you're actually correct, but even changing the sintax, the issue remains.
I tried to remove the internal loops (vExport and after, vMonth) and the external loops (vYear and after, vMonth), but it was no go.
While changing the syntax, it gives the same error informing only the "Next" statement without the variable in front of it.
My confusion here is that it runs fine on other QlikView version on the same computer without changing anything on the file.
I have QV12 12.10 SR9 and it works fine there too.
Sorry, if that seems to be the issue then i suggest you to upgrade the QV version.
Because trying to solve this with a work-around is not a best practice.
But never-the-less you can try another work-around:
SET ERRORMODE = 0;
*Your script here*
SET ERRORMODE = 1;
If it loads the data, then your problems are solved. Even if you upgrade it later the errorscript won't be an issue since the code in other versions is working flawlessly. If not, i would upgrade.
Good luck!
The problem could lie inside the inner loop. Something like an If without an End If. This might be reported as an invalid Next, even though the Next is not causing the problem.
I would not recommend simply hiding the error until you know exactly why the error is occurring. If you are certain that it is a bug, upgrading would be a better option than hiding the error.
In recent versions, Qlik has tightened the semantic checks, so minor issues which the parser ignored are throwing errors now. See the September 2017 release notes for more information on this.