Define the contents of a data page using a Report Definition
Data pages, known previously to Pega 7 as "declare pages," organize and make available to your application data that can come from a range of sources. In earlier versions, the sources were primarily external, accessed with a connector and a load activity; but beginning with version 6.2, you can use a Report Definition as the data source for a data page.
Report Definitions define reports. These reports, while typically used to display summarized information to a user, can also be used to select values for various internal and display features, including data pages.
PrerequisitesIn this example, the Report Definition report uses data from a simple data table. However, Report Definitions can report on any classes from the PegaRULES database, or on flat tables in an external SQL database. For details on using data tables see How to use data tables to reference external and internal systems.
In this example, you populate a data page using a Report Definition that reports on StateCodes, a pre-existing data table consisting of two properties: two-letter state codes, and an operator ID assigned to process work items that involve that state. Both properties are exposed as database columns. (This report output is static, but reports may in practice produce different, real-time results each time they run.)
Create the source reportCreate a new Report Definition. In the Report Definition: New dialog, enter the name of the data class containing the data table in the the Applies To field. Use the Smart Prompt in this field to find your data class more easily.
You will use the name of this report when creating the Declare Page.
- In the Report Definition form, add columns as necessary to populate the data page. The data table in this example contains only two columns, .StateCode and .AssignedOp.
Complete the rest of the Report Definition form, ignoring fields dealing with the visual display of the report or sorting, and save the report.
For more information on completing the Report Definition form, see Report Definition rules - Beyond the basics.
- In the Designer Studio, select the Data Explorer in the explorers area to the left.
- You can then click either menu icon (the general one for the data explorer, or the one beside a data object type you have selected--marked with red rectangles in the image below) and use the option to create a new data page.
- Make sure the data page structure is List.
In the Data Sources section, select Report Definition for the Source, then select the Report Definition you created from the options in the Name field.
- Save the data page. The data page and contained properties are now ready to be referenced by your application.
- Create a new Declare Page. In the Page Class field, use the SmartPrompt to enter Code-Pega-List.The contents of the Data Source section change depending on which option (Load Activity or Report Definition) is selected.
- Select the Report Definition option.
- In the Report Definition Class field, use the Smart Prompt to enter the name of the data class your Report Definition referenced in the Applies To field. In this example, this is the StateCodes data class.
- In the Report Definition field, use the Smart Prompt to enter the name of the Report Definition created previously.
- Save the Declare Page form. The Declare Page and contained properties are now ready to be referenced by your application.
Accessing the Data Page
While the data page now exists, instances of the page are not actually created on a requestor's clipboard until something in the application accesses a property on the data page.
For example: create a new decision, using the a property from the data page you created as one of the decision criteria. Save and unit test the decision shape. An instance of the new data page is now visible on the clipboard tool in the Data Pages node (previous to 7.1, in the Declared Pages node).
For more information on creating and referencing data pages in your application, see Understanding data pages.