Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
agustinbobba
Partner - Creator
Partner - Creator

Execution finished by For Statement

Hi,

In my script I use an iteration statement for several loads, then I load other tables; something like this:

LET v.Product = NoOfRows('$(v.ProductTable)');

FOR i=0 to $(v.Product)-1

     Load *

     Resident AA;

Next;

ProductDetail:

Load *

Resident [Product Detail];

I execute the Script without Errors, but then realized that the execution of the script was not complete.

Then I saw on the log and I found that the variable v.Product was equals to -1, so never load the table ProductDetail; this table is out of the for statement.

My log:

25-Apr-16 11:46:47: 5437  FOR i=0 to -1

25-Apr-16 11:46:48:      Execution finished.

This is a bug?, when the for is from 0 to -1 the scipt stop without error message.

Thank!

Agustín

[Ediit] FOR i=0 to $(v.Product)-1

14 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Weird, I can't even reproduce your situation.

BTW remove the semicolon from the NEXT line and see if that works better.

What version of QV Desktop are you using?

Colin-Albert

You can use the debug window to help find the problem with your script. From the script edit screen you can enable debug mode and step through your script or add breakpoints. As you step through the code you can see the last executed step, the next step and the state of any variables. This should help you see how QlikView is interpreting your script. It may help to add some trace commands to see the values of variables as the script executes.

agustinbobba
Partner - Creator
Partner - Creator
Author

Hi Peter,

I'm using 11.20 SR12 64 bits Edition

Best,

Agustin

Peter_Cammaert
Partner - Champion III
Partner - Champion III

What happens if you delete the FOR loop (including the Next;-line) and rewrite afresh?

Another hint: QV Desktop may start to behave in very weird (even absurd) ways if kept open for very long and performing a large number of failed reloads in succession. Does it help if you save your document, close QV Desktop and reopen it to reload again?

agustinbobba
Partner - Creator
Partner - Creator
Author

I am trying to reproduce the same scenery in a example but I can't.

But I found the problem but like you said QV start to beheva weird, the thing is that below the for i have a drop table to the table Product.

FOR i=0 to $(v.Product)-1 

  TRACE For statement;

  

    LET v.Table = DATE(Today(),'YYYYMMDD');

  NOCONCATENATE

  [$(v.Table)]:

     Load * 

     Resident AA; 

Next; 

DROP TABLE $(v.ProductTable);  

If the v.productTable doesn't exist, the 'drop table' shows error message. But in my code only end the execution. In the example actually shows a error message.

4/25/2016 3:50:36 PM: 0034  LET v.Product = NoOfRows('Product')

4/25/2016 3:50:36 PM: 0036  FOR i=0 to -1 

4/25/2016 3:50:36 PM: 0048  DROP TABLE Product

4/25/2016 3:50:36 PM:          Execution finished.

If my code I put a trace statement before and after the drop table QV says doesn't exist the table and shows a error message.

dt.png

Yes, this is weird..

Well!, thank all for your comments

Agustin.