Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am building my first report so that I can automatically export a PDF to a folder and then distribute via email. I have achieved all necessary parts including setting up a basic report, exporting on reload and then with a scheduler - attaching the PDF to a email and distributing.
My issue is that the QlikView document I have has numerous tabs with various objects, that all use a button and variable combination to cycle through the results for sales, then margin, then quantity. When I go to run the report the only data that is visible is the objects that are currently set by the variable i.e. if the button is on sales then only the sales objects have data and not the margin and quantity.
It is not practical to rebuild the whole QlikView document as there are too many objects to view so I am looking for a way so that when the report runs then it give the data for the object no matter what the variable is set to. Any suggestions would be greatly appreciated.
Example screen shots and info
Here the button is on Margin
Objects that are visible in the QlikView document are all Margin related
My Code for printing the report is
'***************************************************
'Functions creates the reports in PDF format
'***************************************************
sub CreateReports
"D:\DataPDF"
"RP01"
set rep = ActiveDocument.GetReport(reportID)
'Create the file name with path
"" & reportID & "_" & reportName & ".pdf"
'print the report
'Call the function
'Rename the report
'Call the function
call ClearDefault() 'Call the function
end sub
'***************************************************
'Actual function to print the PDF format without being asked for location to save
'***************************************************
function printReportPDF(oReport, pdfLocation)
Set WSHShell = CreateObject("WScript.Shell")
"HKCU\Software\CUSTPDF Writer\DefaultLocation", pdfLocation, "REG_SZ"
"HKCU\Software\CUSTPDF Writer\UseJobName", "1", "REG_SZ"
"HKCU\Software\CUSTPDF Writer\UseDefaultLocation", "1", "REG_SZ"
'QV Print
Below you can see that the only objects with data are the Margin objects. I want to try and find a way to keep the QlikView working as it is but the reports to also show the Sales and Quantity information. FYI the Daily, Weekly, Monthly and Year figures do not work on a variable so that is why they are coming through, but as mentioned above I have to many objects to view all of them without having a variable to display them.
Regards Steve
FYI
I did not get what I needed here to work. The solution I will use is to create a sheet using a variable so that it is hidden, and then create copies of the objects I need in the report - placing them on the new sheet
I still have one issue and that is the document when reloaded through desktop creates a PDF using the trigger OnPostReload (calling the createreport macro) but when it reloaded through the QlikView server it does not.
I will create a new post for this.
Many thanks Miguel for the above info.
Hello Steve,
Although I have not tested it by myself, I'd suggest you to add the following code to your CreateReports macro, just to set the variable to the value where the chart is showed:
set vToggle_Main = ActiveDocument.Variables("vToggle_Main")vToggle_Main.SetContent "Margin", trueChange the content of the variable to Sales or Quantity and you should get three reports, that you may merge later on.
Hope that helps
Hi Miguel
Many thanks for the info. For anyone else who looks at this confirmed code to set the variable is:
set rep = ActiveDocument.GetReport(reportID)
set vToggle_Main = ActiveDocument.Variables("vToggle_Main")
vToggle_Main.SetContent "Margin", true
The problem with this is I will not get all objects populated in the same PDF. Using a similar code or some other method is there any way I can get the report to ignore the variables set in the objects or ensures that it uses or cycles through all three variables?
Regards Steve
You're welcome.
I was wondering, what if that variable is actually a field from an -say- inline table populated with all possible values and you print the report using that field to band it? You can configure that in the Page Settings of the report. So you have all possible values for vToggle_Main and the report creates one page per value, saving (I guess) all pages in the same file.
Regards
FYI
I did not get what I needed here to work. The solution I will use is to create a sheet using a variable so that it is hidden, and then create copies of the objects I need in the report - placing them on the new sheet
I still have one issue and that is the document when reloaded through desktop creates a PDF using the trigger OnPostReload (calling the createreport macro) but when it reloaded through the QlikView server it does not.
I will create a new post for this.
Many thanks Miguel for the above info.