Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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)
11 Replies
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.
dhasharadh
Creator III
Creator III
Author

What is wrong with the below macro,

we are trying to place the generated text files in the \\qlkvapps001.flip.onmicrosoft.com\WUR folder for which we added few lines line Dim FilePath and thats it.

am getting bad file name or number error and this line is getting highlighted. 

Set MyFile = fso.CreateTextFile(strFile) 

Full Macro :

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"

Dim FileNames(2)
FileNames(0)="Esch"
FileNames(1)="Biew"

Dim FilePath(1)
FilePath(1) = "\\qlkvapps001.flip.onmicrosoft.com\WUR"

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 = FilePath(i) & FileNames(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
ActiveDocument.clearAll true
ActiveDocument.Save
ActiveDocument.GetApplication.Quit

End Sub