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
gokulraj
New Contributor

Auto Export of Chart using Macro is not working in Server

Hi Team,

We have a requirement auto export the chart into excel,text,qvd in a particular path.So we given macro condition in Post refresh option found in Document Setting trigger.The macro which i am using is working in local desktop whereas it is not working in UAT server.

Below i attached the macro which i was used.

Macro 1 used to export the chart into txt:

sub ExportExcel
Dim DateTimeNow, DateTimeFormatted
DateTimeNow = Now()
DateTimeFormatted = DatePart("YYYY",DateTimeNow) &"_"& right("0" & "_"& DatePart("M",DateTimeNow),2) & "_"& right("0" & DatePart("D",DateTimeNow),2)

SET varVersion = ActiveDocument.Variables("vExportVersion")
SET varEntity = ActiveDocument.Variables("vEntity")

output= "Our Share path"
vFilename= varEntity.GetContent.String &"_"& DateTimeFormatted &"_"& "V" & right("0"&varVersion.GetContent.String,2) & ".txt"
set obj = ActiveDocument.GetSheetObject("CH01")
obj.Export (output& vFilename) , "|"
end sub

Macro 2: used to export chart into QVD

sub Exportqvd

Dim DateTimeNow, DateTimeFormatted
DateTimeNow = Now()
DateTimeFormatted = DatePart("YYYY",DateTimeNow) &"_"& right("0" & "_"& DatePart("M",DateTimeNow),2) & "_"& right("0" & DatePart("D",DateTimeNow),2)
SET v = ActiveDocument.Variables("vPath")

SET varVersion = ActiveDocument.Variables("vExportVersion")
SET varEntity = ActiveDocument.Variables("vEntity")
set obj = ActiveDocument.GetSheetObject("CH01")
vPathName= v.GetContent.String&"\"&varEntity.GetContent.String &"_"& DateTimeFormatted &"_"& "V" & right("0"&varVersion.GetContent.String,2) & ".qvd"
obj.ExportEx vPathName,4
end sub

Note:  

1. We enabled " Give system access  to Module Script" in Change Module Security.

2. Click on Button to export the macro is working in Server  (our Condition Auto Export)

None of the above are not working in server but working in local.

Please help me to get resolve from here.

Labels (1)
1 Reply
Partner
Partner

Re: Auto Export of Chart using Macro is not working in Server

Post refresh trigger on macros doesnt work on Server/QMC reloads.
One not Qlik recommended way of doing it is to use a bat file which will open the file on QV desktop on server and run it
Other alternative is nprinting