When you have an XRefCode for a report, you can request the data from that report. There are two processes that can be used to retrieve the data. If the set of report data is smaller, such as fewer than 1,000 rows, then you can retrieve all of the data with a single request by submitting a GetReportRequest
object. On the other hand, if the set of report data is larger, then you’ll want to make use of pagination to break the report up into more manageable data sets.
Request All Report Data for a Smaller Report
For reports with smaller data sets, such as fewer than 1,000 rows, you can retrieve all of the data with a single request. To do this:
- Instantiate a
GetReportRequest
object and set theXRefCode
property with the xref code of the report. - Pass this
GetReportRequest
object to theExecute
method.
The response will contain a Report
object which will contain the column and row data.
Sample Code - Request All Report Data for a Smaller Report Without Pagination
Request Report Data of Larger Reports Using Pagination
Retrieving report data via pagination requires the following three step process:
- Open the report which will also set the page size, you’ll do this by submitting a
OpenReportPagesRequest
object. Opening the report will result in a unique ReportId for that instance of the report and you’ll also be given the total number of rows and pages within the report. - Retrieve each page of the report by submitting a
GetReportPageRequest
object and specify in the ReportId and a PageNumber. - Close the report with
CloseReportPagesRequest
. This will clean up the data.
Sample Code - Retrieve Report Data Using Pagination