Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gerhardl
Creator II
Creator II

OnOpen Trigger - macro not working

Hi There,

I have a document with OnOpen triggers.

There are a few triggers, 3 that run macros to create excel reports, and 3 that run macro reloads, saves and quits the document.

The first excel report macros run perfectly, then when the 3rd one runs it opens the Edit Module and then just hangs there. There is no error message. If I click on Okay it then skips that macro and go on with the others (saves and quits).

I can run this macro from a button with no problems.

Any ideas on why this would happen?

I also have another document that should Open, Reload, Save and Quit. It works 95% of the time - but occasionally it just opens and triggers nothing.

I open both these files from a windows batch file.

I feel like the OnOpen triggers are very unreliable... I have no other explantion for why it would only work sometimes..

Any ideas?

G

13 Replies
marcus_sommer

It could have several causes, the network is sometimes too slow and a save-statement is not finish before the next step will exceute - try a sleep or wait statement between the macro parts. Also other windows server activities like windows shadow copies could break the execution without an error message - check the event logging on correlation.

- Marcus

gerhardl
Creator II
Creator II
Author

Sorry, I should have mentioned that this is not on a server - it happens on QlikView Desktop, on a PC I use specifically for scripts and reporting purposes.

I do have a sleep between the reports - but I (for some reason) have them as separate macros. I'm going to add the sleep at the end or start of the report macros themselves, this way there are less macros to execute. Maybe that will help.

Thanks for the feedback.

Any other opinions/comments would be highly appreciated.

marcus_sommer

Another reason could be the start batch-parameter - try changing from /r to /l

http://community.qlik.com/message/296673#296673

- Marcus

gerhardl
Creator II
Creator II
Author

I keep giving you half-detail, because I don't know what is relevant and what not. Apologies for that.

My Windows batch file looks like this:

PowerShell -file "C:\Documents and Settings\GERHARDL\My Documents\TENACITY\Scripts\QLIKVIEW_FILES_COPY.ps1"

So it actually calls a Powershell script, and fromthis PS script I Open the QV file.

This script is now actually busy executing as part of my morning scripts - I have moved around a few things and added additional sleep before the macro that was failing.

Will see if it works today.

gerhardl
Creator II
Creator II
Author

Failed again.

marcus_sommer

Then change the PowerShell script from:

"D:\QlikView_Client\QV.exe" /r "D:\YOURFILE.qvw"

to

"D:\QlikView_Client\QV.exe" /l "D:\YOURFILE.qvw"

Some activities requires run with priority and not as background process.

- Marcus

gerhardl
Creator II
Creator II
Author

The powershell script opens a file like this:

Invoke-Item "C:\Users\tenba1\Documents\QlikView\DAILY QV REPORTS.qvw"

I tried changing the priority here but have not figured out how yet. New to PowerShell.

Teh Scheduled Task (which launches the windows batch file) is set to run on the highest priority.

Thanks for the help - I'll keep playing around and hopefully I can figure it out.

Not applicable

Hey Gerhard,

Are you using On PostReload Trigger anywhere .. beacuse they are very unreliable as mentioned in QlikView Refrence Manual.

Also Please try giving system access to Macro module...CTRL+M opens the macro window.

On the left side you will see two drop downs, Try giving system access via that.

One more thing u can try is in documnet properties there is a security tab,

Select Appropriate options from that which might help you, For Eh: Allow Exoprt

Regards,

Utsav

gerhardl
Creator II
Creator II
Author

Hi Utsav,

No, I only use OnOpen triggers.

System access was already given in the Module.

I did notice in the document security tab that the "Macro Override Security" box was not ticked. I have now ticked this. Not sure if this will make a difference since I can run the macro fine from a button?

What I also now did, was to not run the problem macro on its own anymore, but rather to add this macro's code to another macro that currently runs without problems. So I now have one macro that does two completely different things... which I don't like doing, but now I have one less trigger.

It works when I kick it off manually (but it always does) - so I'll see what happens tomorrow morning.

Thanks.