A Data Page can be used to provide the source for the options of a dropdown user interface control in Pega 7.1.9. The dropdown control can be setup to either show a simple list of items or to aggregate the items with a Group By configuration.
- The below screen shot shows a Pega drop down UI control, where the options (…here US cities) are grouped by a property (…here US state). This post shows how such a drop down can be quickly created in Pega 7.1.9.
- Description of Data Type and Data Page for Storing Cities
- Source the City Dropdown with a Data Page and Group By a Given Property
- Using a Data Page for a Dropdown and Sorting the Options with a Data Transform in Pega 7.1.9
- Iterating over a Page List in a Data Transform in Pega 7.1.6
- In this example, a Data Type named
PGX-MyStore-Data-Citywas created using the Data Explorer.
- The Records tab of that Data Type shows 14 records that were created:
- The Properties of the City Data Type are shown in the Data Explorer in the above screen shot.
- When the Data Type was created, 2 Data Pages were generated as well.
D_CityListis a Page List and contains the 14 instances of
- A section contains a dropdown that allows to select a city based on the
- The dropdown’s properties are shown below. The Data Page
D_CityListis used for the List Source.
Nameproperty is used for displaying the options in the dropdown in ascending order.
- The check box Group Items is checked and the property to group by is set to
- Running the section shows the dropdown with the city options grouped by US state.
- Note that the city names within each group are sorted in ascending order.
- The order can be changed using the Report Definition
DataTableEditorReportthat was automatically created when the
CityData Type was setup. See Example of How to Create Report Definitions in Pega 7 for details on Pega Report Definitions.
- The Query tab of the Report Definition is shown below.
- Here, the City property
Populationis used to sort the records in descending order using
Highest to lowestfor the sort type value.
- When running the section again, the city names within each
Stategroup are now sorted im descending order by
Population, i.e. New York City comes first within the New York state group (…see screen shot of City records at the beginning of this section for population values).