Salesforce provides powerful analytic capabilities through the report and dashboard builders, but there are times when reporting requirements cannot be satisfied through the standard functionality; for example, where data from a number of different sources is required to be presented in multiple formats. In this scenario, Visualforce can give fine-grained control over the layout of the results, while a custom controller allows retrieval of any accessible data in the system.
In this recipe, we will create a Visualforce report that retrieves all cases matching criteria specified by the user and outputs these in a tabular format containing details of all cases, keeping a running total of the number of cases with the same status and origin. Two tables that provide the total count of cases for each status and origin value follow this.