A report is but the query it runs. At times running/requesting a report in IM or GM might result in an error, or alternatively the report will come back empty when it should have data. A beneficial step in troubleshooting such cases is by extracting the query of the report, and run it directly against the underlying data source. This way the requesting product (IM/GM) is taken out of the picture and report database/report server issues can be identified.
How can I extract the query that a report is running, and use it directly against the report data source to troubleshoot reporting issues?
1. Open http://reportServer:port/jasperserver-pro in a web browser.
2. Login as:
username: superuser
password: superuser
3. From the top menu. select View --> Repository
4. On the left pane, navigate to your "reports" folder.
For IM: IAM->IM->reports
For GM: GM->reports
A list of reports will display.
5. Right-click the report you want the query of, and select Export.
<Please see attached file for image>
src="/servlet/servlet.FileDownload?file=0150c000004AKnCAAW" alt="1.png" width="404" height="379">6. A message window will display:
<Please see attached file for image>
src="/servlet/servlet.FileDownload?file=0150c000004AKnDAAW" alt="2.png" width="286" height="207">7. Leave these default values (give a unique name to the export file), and click Export.
8. This will create the export.zip in the jasper folder.
9. Extract the zip file and search for the <report name>.xml.
10. Open the file in a text editor and search for the first occurrence of the word 'select'.
11. This will be the Query parameter of the block, and that is the query the report runs.