Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reload fails with error on End Sub

Hello

I have a piece of script which is like this :

connect to database

Sub Load_DB(year, week)

     ...

     my_Table:

     Load myField

     SQL

     Select ... From ... Where DB_YEAR = $(year) And DB_WEEK = $(week);

     ...

End Sub

Call Load_DB(2010, 31);

Call Load_DB(2010, 32);

Call Load_DB(2010, 33);

Call Load_DB(2010, 34);

Call Load_DB(2010, 35);

Call Load_DB(2010, 36);

Call Load_DB(2010, 37);

Store in QVD;

end of script

Well, the select is about 125 lines with a lot of pre-calculation so I do not detail it here but I really need to calculate one week at a time.

Problem is that after few call of the sub, the script quits with error. Number of call before error is not always the same... depends on the moon maybe ?

Did anyone face such thing before?

Thank you all for your help

Hubert

1 Reply
erichshiino
Partner - Master
Partner - Master

Hi,

I had a problem before when sometimes QV didn`t recognize the sub, but them none of them would work.

Can you change the sub, so qv will wait between two calls? (try including a sleep 100 before the end sub).

Another approach would be:

- Create a table with all the years and weeks you need to load, then you create a loop to read those records one by one and then you reprodure the code of your sub.

Hope this helps,

Erich