Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

execute macro during script reload

Hi All,

I have a macro that export fields in a chart to QVD. Initially I only have one business unit to reload, so I use OnPostReload event to export the fields and create the QVD.

Now, I have more business units to reload so I put a for loop in my script to reload from another database. My issue now is to trigger the macro to export the fields to QVD, one time for each business unit.


I tried to use variable OnChange event and set the variable to another value during script reload but the macro would not execute. Can my setting be wrong or this variable OnChange event is effective during user intervention from layout only?

Any input is greatly appreciated! Been stuck for hours. Thanks a lot!

3 Replies
Not applicable
Author

I reload my file by invoking a .bat file that reloads the document that opens it again passing a variable/value named pair:

CALL "C:\PROGRAM FILES\QLIKVIEW\QV.EXE" /R "E:\QVApplications\QVCustomers\mydoc.QVW"
CALL "C:\PROGRAM FILES\QLIKVIEW\QV.EXE" /VvExport=1 "E:\QVApplications\QVCustomers\mydoc.QVW"

Attached to the OnOpen event is a macro that checks the value of the variable (set to 0 in the document) then does whatever is required:

set doc=ActiveDocument
vExport = doc.Variables("vExport").GetContent.String
if vExport = "1" then
(do stuff)
doc.GetApplication.Quit
end if

Hope that helps.

Gordon

Not applicable
Author

Hi

I don't understand the problem really...
What's stopping you from loading all data and then run the macro onPostReload just as you do now and save all business units at the same time?

/Fredrik

Not applicable
Author

Hi Gordon,

Thanks for your idea. My client is using QVS9 to schedule the reload thus eliminating the bat file.

Hi Fredrik,

My client wants to keep 1 qvw file to 1 business units. When i export the QVD, it should go to different folder as per the business unit. Any idea?

Thanks!