Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlikview Personal edition reload with Windows task scheduler

Hi Guy,

I am on PE at the moment, My requirement while evaluating Qlik for our company is below, Please can anybody help me on this

I have a very small amount of data from csv file, Now I have created couple of charts and want this to be automatically reload and update the records. The idea is to open the desktop edition on a screen in the office and schedule the reload every 15 mins so that the records gets updated, I have successfully made it to reload with -r command but this is not updating the records while the document is open, I also tried command L which always opens a new instance of desktop and updates the record but doesn't save the qvw which is fine, but am struggling to find a way to not open new instance but to show in the current open qvw (desktop itself), Is there a way to do this please...

Thanks for your help

36 Replies
marcus_sommer

For me it worked - with slight adjustments by save which is now outside the loop and including a waitforidle:

Option Explicit

sub UpdateReport

Dim QD, doc, i

set QD = ActiveDocument.GetApplication

set doc = ActiveDocument

for i = 1 to 1 * 4 '* 12 'running 12 hours each 15 minutes

     doc.ReloadEx 0,1

     QD.WaitForIdle

     QD.Sleep 3000 '1000 * 60 * 15 'sleep for 15 minutes

next

doc.save

doc.CloseDoc

QD.Quit

end sub

The macro is called from an OnReload-trigger and the qvw was batch-executed (didn't want to create a task for it) with the parameter /l and this load-statement with the result displayed in a textbox.

- Marcus

stabben23
Partner - Master
Partner - Master

Hi,

create this vba:

function Check
set var = ActiveDocument.Variables("vReload")
val = var.GetContent.String
if val = 1 then
call RefreshData
end if
End function


Sub RefreshData
'Reload new data
ActiveDocument.DoReload 2,false,false
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Save
ActiveDocument.GetApplication.WaitForIdle
End Sub

And create variable vReload in the Application:

=if(pick(match(right(minute(now(1)),1),4),4),1,0) //this will reload the document when minutes become 4 on clock, so every 10 minute.

With this, no windows scheduler is needed.

stabben23
Partner - Master
Partner - Master

This line is the key here.

ActiveDocument.DoReload 2,false,false

it will reload Your Application without Close or reopen the app. You will just notice the "reload Wheel" during the reloadpart.

Anonymous
Not applicable
Author

Hi swuehl,

That worked like a charm, Thanks a lot............One final question, is there a way we can not display the script execution process? 

Thanks for making it achievable

Qlikview always the best

swuehl
MVP
MVP

Not sure if you can do this.

You can make it smaller and / or move the dialog outside the screen window.

Anonymous
Not applicable
Author

The application is reloading for every 2 seconds if I give =Round(Now() , maketime(0,15,0)), I would expect it to be running every 15 mins, I tried to change the value 15 to 20, 25, 50,59.....what ever value I give it reloads every 2 seconds...if I give =Round(Now() , maketime(0,60,0)) it doesn't do anything. I have tried to see the the timings of all the above values and they seem to be right..like for example =Round(Now() , maketime(0,23,0)) it gave me "=DATE($(vTest1),'hh-mm-ss')" = 15-26-00 but still reloads every 2 seconds, not waiting for that time to reach?


Any idea please, My requirement is to load the data every 15 mins or 30 mins or 1 hour......


PS - I also used this but still it loads every 2 seconds "=if(pick(match(right(minute(now(1)),1),4),4),1,0) "

swuehl
MVP
MVP

Hm, it works at my side.

If you put the variable in an input box, do you see the value change every two seconds?

What if you change the variable to

=Div(Round(Frac(Now())*60*60*24),15) // 15 seconds

=Div(Round(Frac(Now())*60*24),15) // 15 minutes

edit:

These are reload times using the second last variable definition.

17:26:57

17:26:59

17:27:00

17:27:15

17:27:30

17:27:45

17:28:01

17:28:15

17:28:30

Reload is performed every 15 seconds (+-1 second is ok IMHO). First two entries due to initial reload.

Anonymous
Not applicable
Author

I have tried =Div(Round(Frac(Now())*60*24),15) // 15 minutes this as well but its the same, Please find below the attached document for screen shots please

Anonymous
Not applicable
Author

Seems like some format issues with the date/time? what ever I do it is reloading every 2 seconds,unless its 0,60,0 which doesn't do anything, By any chance do I need to change my any of the below?

SET TimeFormat='hh:mm:ss';

SET DateFormat='DD/MM/YYYY';

SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';


Thanks again

Anonymous
Not applicable
Author

If I put the variable in the input box it remains to a value until 15 seconds, but again the reload is performed every 2 seconds... , one last hurdle to overcome , Please help