Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Not applicable

Macro not working when reloading from command line

Hi all,

this is a very weird situation.

I have a simple script to export a csv file that is called  when OnPostReload event is fired.

Sub ExportToCSV

  set sObject1 = ActiveDocument.GetSheetObject("ClientiUnivoci")

  sObject1.Export "Output\ClientiUnivoci_Week_" & Year(Now()) & LPad(Month(Now()),"0",2 ) & LPad(Day(Now()),"0",2 ) & ".csv", ";", 65001

End Sub

When I launch reload inside qlikview the script works fine and the file is generated, when I lanch qlikview reload from a batch file using the following command:

"C:\Program Files\QlikView\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

the qlikview file is reload but the macro is not executed and the csv file is not generated.

I made the following attemps without success:

  • "C:\Program Files\QlikView\Qv.exe" /r /NoSecurity "C:\Qlikview\Project\LastWeek.qvw"
  • Settings | Document Properties | Security -> All checked except Allow Print, Show All Sheets and Objects and Show Progress for Hidden Script
  • Settings | User preferences | Security -> All checked except Confirm Launch from Macro
  • Tools | Edit Module | Request Module Security -> System Access
  • Tools | Edit Module | Current Local Security -> Allow System Access
  • Run batch as Administrator

I don't really know what to do more.

Do you have any ideas?

Thanks in advance.

Nicola


1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Macro not working when reloading from command line

Mostly it are the small things ...

13 Replies
SreeniJD
Valued Contributor

Re: Macro not working when reloading from command line

Hi Nicola,

I guess, you can execute through windows batch file. Btw, do you have QV server?

Execute cmd.exe /C C:\BatFiles\Example.bat


Regards,

Sreeni

Not applicable

Re: Macro not working when reloading from command line

I'm already using a Windows bat file.

The bat file contains the following code:

"C:\Program Files\QlikView\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

When I run the bat file qlikview reloads correctly but the macro is not executed.

I don't have QV server.

Thanks.

SreeniJD
Valued Contributor

Re: Macro not working when reloading from command line

Hi Nicola,

Your windows bat file script is correct..

cd "C:\Program Files\Qlikview\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

I wondering, is there any service that is down causing the issue.. Can you please check the services in Control panel?

Regards,

Sreeni

Not applicable

Re: Macro not working when reloading from command line


Hi Sreeni, first of all thanks for your help.

I don't believe it's a problem of services, I copied the qlikview file on another machine and the issue remains exactly the same. Furthermore on the same machine I have lot of other qvw files that work in the same manner called by a batch file. So I don't really understand where the problem could be. If I'll find out a solution I will post it,

any other idea is appreciated.

Thanks a lot.

Nicola

MVP & Luminary
MVP & Luminary

Re: Macro not working when reloading from command line

Make a try with /l as parameter:

"C:\Program Files\QlikView\Qv.exe" /l "C:\Qlikview\Project\LastWeek.qvw"

- Marcus

Not applicable

Re: Macro not working when reloading from command line

Done. The QV file remains open but the macro in not executed.

Thanks

MVP & Luminary
MVP & Luminary

Re: Macro not working when reloading from command line

Check this too: Settings | User preferences | Security -> All checked except Confirm Launch from Macro

Not applicable

Re: Macro not working when reloading from command line

Nothing to do.

Thanks the same Marcus.


MVP & Luminary
MVP & Luminary

Re: Macro not working when reloading from command line

But in general this approach worked - I do the same since years. How do you execute the batch - as normal windows user which clicked on the batch within the explorer quite similar you open the qvw itself to start the reload or is this different from them?