Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dhasharadh
Creator III
Creator III

On post reload option is not working in Qv desktop ??

we have a requirement of exporting the data for which we wrote one macro and want that macro to be executed on post reload of the app.

So i used on post reload option and gave that macro name - but nothing happening, nothing generated as well. 

and i reloaded it manually only not from QMC. Any specific reason why this does not work for me...?

am also attaching the other method i tried, i used a button and added an action of running the macro, and again i wrote an another macro to trigger the button. but that is also not working. please suggest any changes in the macro.

Thanks Much in advance.

@marcus_sommer @sunny_talwar @jagan @santiago_respane  @rubenmarin 

Labels (2)
1 Solution

Accepted Solutions
Brett_Bleess
Former Employee
Former Employee

About the best I can offer is some past knowledge that I believe to still be true which is that Publisher ignores all triggers, but I cannot find that we really have this documented, so I am submitting a feedback on the related Help area to try to get this rectified, as I am pretty certain I am still correct about this.  What the guys have mentioned regarding using QV.exe /r is the only method, but even then trying to run OnPostReload may or may not work, as you have a conflict with the /r trying to close down the QV.exe process post reload and the OnPostReload trigger trying to run as well, this is going to be troublesome as far as I recall too.  Best I have in addition to the above comments, but Help should get an update in the coming weeks too.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.

View solution in original post

11 Replies
rubenmarin

Hi, those kind of macros needs access to file system, in macro dialog (CTRL+M) you need to give permission.

The required module security needed is System Access and the Actual Local Security set to Allow system access

dhasharadh
Creator III
Creator III
Author

@rubenmarin  thanks for your time, yes both the above options are checked but still attached macro is not executing with on Post reload option...

Please check the attached macro once.

rubenmarin

It's still in "Virus scan in progress" state, not allowing to open.

dhasharadh
Creator III
Creator III
Author

Sub export
ActiveDocument.clearAll true
curMonth = Month( DateAdd("M",-1, Date))
if curMonth<10 then curMonthS="0" & CStr(curMonth) else curMonthS=CStr(curMonth)
IF curMonth=1 OR curMonth=3 OR curMonth=5 OR curMonth=7 OR curMonth=8 OR curMonth=10 OR curMonth=12 Then
noofdays=31
else noofdays=30
end if

Dim wellNames(2)
wellNames(0)="Eschenfelden US"
wellNames(1)="Bierwang US"

Set fso = CreateObject("Scripting.FileSystemObject")

For i = 0 to 1
ActiveDocument.Fields("%KEY_REPORT").Select WCONHIST,WCONINJH
ActiveDocument.Fields("GASMONTH").Select Year(Date)&"-"&curMonthS
ActiveDocument.Fields("SP.LANGBEZ_SSO_SPEICHER").Select wellNames(i)

strFile="F:\Test\Sch_section_" & wellNames(i) & "_UGS_01_" & curMonthS & "_" & noofdays & "_" & curMonthS & "_" & Year(Date) & ".txt"
Set MyFile = fso.CreateTextFile(strFile)

set table = ActiveDocument.GetSheetObject( "TB02" )
for RowIter = 0 to table.GetRowCount-1
set cell = table.GetCell(RowIter,0)
MyFile.WriteLine(cell.Text)
next
MyFile.Close
Next


End Sub

dhasharadh
Creator III
Creator III
Author

Thanks again Rubenmartin, 

please find the below macro, i just want to execute that macro after reload the app. That is my requirement. 

tried adding this run macro option to a button, and if i click on that button manually its working perfectly correct. but in order to press the button after the reload again i have to go to an other macro, which is resulting in 2 macros and that is also not working. 

please guide me how can i run this macro on reload of the app, and i dont schedule this app using QMC, i use windows task scheduler to run this, this just need to be run 5th of every month thats all.

 

 

marcus_sommer

Please check if the macro is spelled correctly within the OnReload trigger. If yes, create another macro with only something like:

msgbox "test"

and apply it to the OnReload trigger - what happens?

Just see your last paragraph - try it directly within the desktop client not per batch.

- Marcus

rubenmarin

Hi @dhasharadh I tested this link and it creates the csv file from a windows task: https://community.qlik.com/t5/QlikView-Documents/Export-data-from-table-chart-from-a-qlikview-app/ta...

dhasharadh
Creator III
Creator III
Author

@rubenmarin , sorry i actually over looked i used post reduce option by mistake, when i used on post reload its working perfectly fine and am able to generate the files as expected. 

But as macro based apps are not executed in QMC, we have to  use windows batch scheduler to schedule this app, when i use /r in between qv.exe file and app name its just reloading but macro is not running. 

what i have to use in batch file to execute the app fully including macros.

rubenmarin

Hi, have you checked the attachments of the previous link?: https://community.qlik.com/t5/QlikView-Documents/Export-data-from-table-chart-from-a-qlikview-app/ta...

There is a document with requirements to make it work with windows batch scheduler.