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: 
Gator
Partner - Contributor II
Partner - Contributor II

Qlikview Macro

I have a user who wants a straight table in the QVW to be exported to Excel and sent to him in email every morning at 6:00. I wrote a macro to create and save the spreadsheet which works fine and I wrote a trIgger using OnOpen which will run the macro. I know the macro won't work on the server (I've tried), so I'm thinking about writing a batch file with a command line to open the QVW in Desktop. That should trigger the macro. One problem - I can open open QV on the command line but after the macro runs how can I close QV? 

Labels (1)
4 Replies
Gator
Partner - Contributor II
Partner - Contributor II
Author

So I wrote the following batch file to do the above:

@Echo off
copy "F:\QV Work\abc.qvw" "F:\QV Work\Test Projects\abc_Reports.qvw"
"C:\Program Files\Qlikview\qv.exe" "F:\QV Work\Test Projects\abc_Reports.qvw"
call Powershell "F:\bin\SendEmail.ps1"
exit

The abc.qvw has already been reloaded before this in the QMC so I don't want the /r switch when I open abc_reports.qvw. I have an OnOpen trigger which runs the macro to create the Excel file and the Powershell script mails it. All of these pieces work individually but the problem is that when qv.exe opens it seems to run in the background (I can see it in Task Manager) as it doesn't open on the screen and the OnOpen trigger doesn't fire. The Powershell script also doen't appear to fire. If I get it to work I want to put the batch file in Task Scheduler. What am I doing wrong?

 

 

marcus_sommer

Gator
Partner - Contributor II
Partner - Contributor II
Author

Hi Marcus - Thanks for the reply. The problem isn't with sending the email, the problem is with scheduling the batch file to run using Task Scheduler. If I run the batch file from the desktop it runs fine, but if I create a task in Task Scheduler it doesn't run at all. Not sure why. 

marcus_sommer

There are a lot of possibilities what could go wrong - most often it are missing/wrong access rights, licence-topics and user-settings. Probably you use the services-account from the QlikView services and this user must have the appropriate access rights to the target and a valid QlikView desktop licence and also an Excel licence and in both the appropriate user-settings.

Further the task itself must run with these credentials and with the highest priorities. Depending on the environment it could become quite tricky to get it to work.

- Marcus