Get Report Data
You can use the ReportResults class to get the fact map, which contains data that’s associated with a report.
To access data values of the fact map, you can map grouping value keys to the corresponding fact map keys. In the following example, imagine that you have an opportunity report that’s grouped by close month, and you’ve summarized the amount field. To get the value for the summary amount for the first grouping in the report:
- Get the first down-grouping in the report by using the
ReportResults.getGroupingsDownmethod and accessing the firstGroupingValueobject. - Get the grouping key value from the
GroupingValueobject by using thegetKeymethod. - Construct a fact map key by appending
'!T'to this key value. The resulting fact map key represents the summary value for the first down-grouping. - Get the fact map from the report results by using the fact map key.
- Get the first summary amount value by using the
ReportFact.getAggregatesmethod and accessing the firstSummaryValueobject. - Get the field value from the first data cell of the first row of the report by using the
ReportFactWithDetails.getRowsmethod.