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: 
it_bi_vg
Contributor
Contributor

Run Macro from Console

Hello,

I've the application "A" that runs this macro, after Event PostReload or on demand from button.

set objExcel=ActiveDocument.GetSheetObject("CH01") 
objExcel.ExportEx filepath,4

I' ve publisher and I'd like to schedule  it from Management Console every day , but I can't reload this macro. It doesn't work. 

I don't like to use Windows Scheduler, I prefer to use only Qlikview tools.

I've red this: The OnPostReload event is not fired after a server reload. 

if it wasn't possible, I would run on demand from other application "B".

In other words, Application "B" has a button (on demand from users), it opens application "A" and run macro or when I load script, it executes statement or file.bat that export table to qvd.  

Thanks for your help

 

 

11 Replies
pradosh_thakur
Master II
Master II

Post reload trigger will not work on QMC. It only will work when run manually or from scheduler.

I can list out a few option you can explore.

1: store table using "store table into table.qvd" from script.

2: Run it from window scheduler as you have asked.

3: Run a task from qmc which will in turn run a batch file which will open a qvw on the server , do a reload , run the macro, store the table and close the qvw again.

 

It's up to you what you choose.

 

Thanks

Pradosh

Learning never stops.
it_bi_vg
Contributor
Contributor
Author

I can't use the first option, because I'd like to store a table with difficult and long KPIs .

I can use the third.

I've written Test_vbs :

Set objShell = CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
dim CurrentDirectory
CurrentDirectory = fso.GetParentFolderName(Wscript.ScriptFullName)
set qv = CreateObject("QlikTech.QlikView")
dim qvDocName
qvDocName = fso.BuildPath(CurrentDirectory, "test.qvw")
objShell.AppActivate("test.qvw")
set doc = qv.OpenDoc(qvDocName)
set obj = doc.GetSheetObject("CH01")

obj.ExportEx "test.qvd",4
doc.CloseDoc
qv.Quit

<<<<------------------------------------------->>>>

I've written test.bat

@echo off

wscript "C:\Desktop\test\Test_vbs.vbs"

<<<<------------------------------------------->>>>

In my qvw :

Execute cmd.exe /C test.bat ;

<<<<------------------------------------------->>>>

If I click on the test.bat , it works, If I run qvw, it doesn't create the qvd.

Thanks.

it_bi_vg
Contributor
Contributor
Author

I can't use the first option, because I'd like to store a table with difficult and long KPIs .

I can use the third.

In my qvw :

Execute cmd.exe /C test.bat ;

<<<<------------------------------------------->>>>

If I click on the test.bat , it works, If I run qvw, it doesn't create the qvd.

Thanks.

pradosh_thakur
Master II
Master II

documnet setting-> security-> all macro overrides security are checked and run external programs are checked.

user preference-> macro related check 

last but not the least

go to script (ctrl+E) -> On the bottom where there is odbc connection option etc are there there is a setting tab -> setting-> can execute eternal commands -> check

run it again and it  shall work.  attach scrrenshot of these if it doesn't.

 

Thanks

Pradosh

Learning never stops.
it_bi_vg
Contributor
Contributor
Author

I've already set all parameters but I see only black window. 

Cattura.PNG

pradosh_thakur
Master II
Master II

run some other batch file that will do a simple task like copying a file or something and see if that works or not.
Learning never stops.
pradosh_thakur
Master II
Master II

Hi 

 

I think you need to provide the absolute path of the batch file in double quotes if it contains space.

 

Execute cmd.exe /C     "c:/... absolute pathe to the file ... test.bat ";

Learning never stops.
it_bi_vg
Contributor
Contributor
Author

If I use simple vbs , it works.

pradosh_thakur
Master II
Master II

@it_bi_vg  did you use the absolute path to the bat file in double quoted after cmd.exe /c ?

Learning never stops.