Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pulling the report ID with a macro without using the backend

In the Report Editor window, there is a list of Available reports for the document and the user. Is there a way to pull the reports for either category by the value in the Id column into a macro without building a table in the backend and loading this data manually?

If so, can a macro example be posted. Thanks.

1 Solution

Accepted Solutions
Not applicable
Author

Hi

This is straight from the API guide:
sub reports
set reps = ActiveDocument.GetDocReports
for i = 0 to reps.Count-1
set rep = reps.Item(i)
msgbox(rep.Id)
next
end
sub

Hope it helps

/Fredrik

View solution in original post

2 Replies
Not applicable
Author

Hi

This is straight from the API guide:
sub reports
set reps = ActiveDocument.GetDocReports
for i = 0 to reps.Count-1
set rep = reps.Item(i)
msgbox(rep.Id)
next
end
sub

Hope it helps

/Fredrik

Not applicable
Author

Thank you this was exactly what I was looking for to accomplish my task as coded below. Noticed that the Document reports and User reports are distinguished by a prefix (for example: Document\RP01) so had to strip it out.

sub reports
tempFolder = "U:\Transfer\"
set reps = ActiveDocument.GetDocReports
for i = 0 to reps.Count-1
set rep = reps.Item(i)

reportID = rep.Id
if InStr(reportID, "\") > 0 then
reportID = Mid(reportID, (InStr(reportID, "\")+1))
end if

reportName = rep.Name

reportFile = tempFolder & reportID & "_" & reportName & ".pdf"

printReportPDF reportID, reportFile


next
end sub