Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Has this issue happened to anyone else? I have a QVW that run a OnPostReload() and when reloaded via qv.exe /R it doesn't always run. When reloaded "manually" it works perfect. Anyone have any suggestions?
What I do is assigning the macro to a button (call it BU01 for example).
Then create the following vbs code:
Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("C:\test\toto.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press
Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing
This will open the document then reload then run the macro.
Then the document is closed.
In Publisher you can then create an external command task.
Rgds,
Sébastien
so anyone know why this can be happening?
I never trust the trigger as I have experienced the same problem. I use one of two methods:
1) After the reload with a /R I then invoke the document again passing a variable with a specific value using the /V switch. I have a macro that runs as the OnOpen trigger and if the variable value is as per the passed value, it runs some code. I wrap these 2 lines in a .bat file.
CALL "C:\PROGRAM FILES\QLIKVIEW\QV.EXE" /R "E:\QVApplications\QVCustomers\CUSTOMER SEGMENTATION.QVW"
CALL "C:\PROGRAM FILES\QLIKVIEW\QV.EXE" /VvExport=1 "E:\QVApplications\QVCustomers\CUSTOMER SEGMENTATION.QVW"
2) Create an alert that runs On Post Reload in batch mode to send an email if something unusual was detected in the load script (such as a file not found)
Hope this helps,
Gordon
regards solution 1) the macro is like this:
sub ExportData
set doc=ActiveDocument
vExport = doc.Variables("vExport").GetContent.String
if vExport = "1" then
......
doc.GetApplication.Quit
end if
end sub
What I do is assigning the macro to a button (call it BU01 for example).
Then create the following vbs code:
Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("C:\test\toto.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press
Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing
This will open the document then reload then run the macro.
Then the document is closed.
In Publisher you can then create an external command task.
Rgds,
Sébastien
thanks spastor, it works perfectly.
Sébastien,
Your code is working great but OpenDoc() is using the QV window that is currently opened. Is there a way to instantiate a new QV window? Thanks.
problem : can't set macro to allow system access from RELOAD (option /r not work)
Ref : http://community.qlik.com/message/18973
Ref : http://community.qlik.com/message/21833
Ref : http://community.qlik.com/message/165717
1.Create Batch file ==> "C:\Program Files\QlikView\qv.exe" /l "path_to_document"
2.Create Task Scheduler to RUN Batch file (1)
3.QVW Document ==> Document properties > OnPostReload ==> Add RUN MACRO
4.add (end of script)
ActiveDocument.Save
Application.Quit
don't forget
1. User Preference >Security > select "Module..." and "File.."
2. Document Properties > Security > Macro Override Security
Thanks for this useful summary! Switching from qv.exe /r to /l fixed it for me.