How to Delete a Class and All of its Rules in Pega 7

Classes in Pega 7 can be deleted using the Delete Class Wizard. This wizard can be used to remove a class and all the rules it contains from a Pega 7 instance.

Summary

  1. Description of Sample Class to be Deleted
  2. Deleting a Class with the Delete a Class Wizard

Related Posts

Screen shot - Pega 7 Designer Studio - Application Explorer, View Claim Class

  • The Class of the Claim case type can be opened by right-clicking on its name in the Application Explorer and selecting Definition.

Screen shot - Pega 7 Designer Studio - Application Explorer, View Claim Class Definition

  • Claim is configured using belongs to a class group, with the class group set to PGX-MyStore-Work. Therefore, instances of Claim are stored in the Pega DB table for PGX-MyStore-Work.
  • Clicking on the Test Connection button opens a dialog that shows the mapping of the PGX-MyStore-Work-Claim class to a Pega DB table named pegadata.pc_PGX_MyStore_Work.

Screen shot - Pega 7 Designer Studio - Edit Class, Test Connection and View Table Mapping

SELECT 
    pxcreatedatetime, pzinskey, pxinsname, pxobjclass
FROM 
    pegadata.pc_pgx_mystore_work;
  • The screen shot below shows that the table contains 4 rows.

Screen shot - pgAdmin - Browse pegadata.pc_pgx_mystore_work table

  • The first row represents the default work pool class, ending in -Work.
  • The other 3 rows are instances of the Claim class that were created when running the application.

  • A class can be deleted manually in the Designer Studio using the Delete button on the Edit Class form. This operation will result in an error if: a) the class contains instances or b) if the class contains any other rules.

Screen shot - Pega 7 Designer Studio - Edit Class, Delete with ERROR containing Instances

  • A class can only be deleted this way if all instances and containing rules have been removed first.
  • This can be a tedious manual process. Therefore, Pega 7 provides the Delete Class Wizard. It will automatically delete all instances and containing rules when deleting a class.
  • To open the wizard, use the Designer Studio main menu and navigate to System > Refactor > Classes.

Screen shot - Pega 7 Designer Studio Menu - System, Refactor, Classes

  • On the Class Refactor Utilities form, click on Delete a Class.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Selection Option, Delete a Class

Step 1: Select Class to Delete

  • Enter the name of the class that will be deleted, here the name is PGX-MyStore-Work-Claim and click on Next.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Delete a Class, Step 1: Select a Class to Delete

Step 2: Display Classes to Delete

  • A warning message will be shown and all classes to be deleted are listed. Review and click on Next to trigger the deletion of the class.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Delete a Class, Step 2: Show Warning Message

Step 3: Reference Search

  • If needed, this step of the wizard allows to search for and list all references to the class that was deleted.
  • Select the option, here Search for references in all RuleSets, and click on Next.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Delete a Class, Step 3: Reference Search

  • If the wizard found any references in the specified RuleSets, they will be listed on the next screen. In this example, no references to the deleted class exist.
  • If references were found, the list of references could be exported to Excel or PDF using the buttons.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Delete a Class, Step 3: Reference Search View Results

  • Click on Finish to complete the process and the on Done to close the wizard.

Screen shot - Pega 7 Designer Studio - Refactor Class Utilities, Delete a Class, Rule Management Process is now Complete

  • The class has now been deleted from the Pega instance and the Application Explorer and Designer Studio search controls can be used to confirm this.

Screen shot - Pega 7 Designer Studio - Application Explorer, Search for class, Class does not exist

  • The Pega DB table pegadata.pc_PGX_MyStore_Work now contains only 1 row, which represents the default work pool class. The 3 instances of the Claim class have been removed.

Screen shot - pgAdmin, browse table for Claim class after class deletion

Source Dropdown Options from a Data Page and Group by a Property in Pega 7.1.9

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.

Screen shot of Pega 7 section with Dropdown grouped options

Summary

  1. Description of Data Type and Data Page for Storing Cities
  2. Source the City Dropdown with a Data Page and Group By a Given Property

Related Posts

  • In this example, a Data Type named PGX-MyStore-Data-City was created using the Data Explorer.
  • The Records tab of that Data Type shows 14 records that were created:

Pega 7 Data Type - PGX-MyStore-Data-City, Records Tab

  • 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_CityList is a Page List and contains the 14 instances of PGX-MyStore-Data-City.

  • A section contains a dropdown that allows to select a city based on the D_CityList Data Page.

Pega 7 Dropdown - Select City

  • The dropdown’s properties are shown below. The Data Page D_CityList is used for the List Source.
  • The Name property 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 .State.

Pega 7 Dropdown Configuration - Configure List Source, Group By

  • Running the section shows the dropdown with the city options grouped by US state.

Pega 7 Dropdown - Preview Page with City Dropdown

  • Note that the city names within each group are sorted in ascending order.
  • The order can be changed using the Report Definition DataTableEditorReport that was automatically created when the City Data 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.

Pega 7 Edit Report Definition - City Data Type Edit Columns

  • Here, the City property Population is used to sort the records in descending order using Highest to lowest for the sort type value.

Pega 7 Dropdown - Sort Cities by Population Size

  • When running the section again, the city names within each State group 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).

Using a Page List for a Dropdown and Sorting the Options with a Data Transform in Pega 7.1.9

A Data Transform can be used in Pega 7.1.9 to sort list structures such as a Page List. In this example, a Data Transform is used to show how to sort the entries of a Dropdown control that is backed by a List-type Data Page. In addition, another Data Transform is shown that sorts the Page List based on two properties.

Summary

  1. Description of Data Type and Data Page for Storing Cell Phone Models
  2. Using an Activity, Section and HTML Rule to Display a Dropdown of Phones
  3. Using a Data Transform to Sort the Page List

Related Posts

  • Here, a Data Type named PGX-MyStore-Data-Phone was created using the Data Explorer.
  • The Definition tab of the Data Type shows its properties:

Data Type Rule - Definition Tab - Phone

  • The Records tab shows the 13 instances that have been created for this Data Type.

Data Type Rule - Records Tab - Phone

  • The Sources tab shows the 2 Data Pages that have been created automatically.

Data Type Rule - Sources Tab - Phone

  • The data page D_PhoneList is of type List and can be used to retrieve all instances of the PGX-MyStore-Data-Phone Data Type.

Data Page - Definition Tab - ListPhone

  • Use Actions > Run to run the data page and view its XML representation. There will be a node called pxResults that contains the list of phones.

  • A form was created to show a dropdown that allows to select a phone based on the D_PhoneList Data Page.

Section - Runtime - Show Dropdown for Phone Selection - Default no Selection

  • Clicking on the dropdown shows the options provided by the Data Page. Note that the order of the items is the same as shown on Data Type > Phone > Records, i.e. the list is sorted ascending by the ID property of PGX-MyStore-Data-Phone.

Section - Runtime - Show Dropdown for Phone Selection - Display Dropdown Options

  • The following rules were used to create the HTML page with the phone dropdown control:
An Activity rule named ShowPhoneOrderSection
A HTML rule named MyPhoneStore
A Section rule named PhoneOrderForm
  • The ShowPhoneOrderSection Section rule containing the dropdown control is shown below:

Edit Section Rule - PhoneOrderForm - Design Tab

  • The configuration of the Dropdown rule is shown below, note the List source section, which refers to the Data Page:

Phone Selection Dropdown - Dropdown Properties

  • The MyPhoneStore HTML rule uses the <pega:include> tag to include the section rule by name.
<pega:include name='PhoneOrderForm' type='Rule-HTML-Section'></pega:include>

HTML Rule - HTML Tab- MyPhoneStore

  • The ShowPhoneOrderSection Activity rule contains one step that uses the Show-HTML method to render and display the HTML rule.

Activity Rule - Steps Tab - ShowPhoneOrderSection

  • When running the Activity using Actions > Run, it will display the HTML page shown at the beginning of this section.

  • A new Data Transform called SortByPhoneNameASC with an applies-to class of PGX-MyStore-Data-Phone was created. On the Pages & Classes tab, the following entries have to be added:
D_PhoneList with class name Code-Pega-List
D_PhoneList.pxResults with class name PGX-MyStore-Data-Phone

Data Transform Rule - Pages and Classes Tab - SortByPhoneNumberASC

  • On the Definition tab, the first and only step uses the Sort method.

Data Transform Rule - Definition Tab - SortByPhoneNumberASC

  • The gear icon is used to configure the Sort method. Clicking on it opens a new layer.

Data Transform Rule - Definition Tab - Sorting Properties

  • Here, the Sort method is configured to sort the list of phones by the Name property of PGX-MyStore-Data-Phone in ascending order.
  • The ShowPhoneOrderSection Activity was modified and a step was added before displaying the HTML page.
  • The first step in the modified Activity uses the Apply-DataTransform method to use the SortByPhoneNameASC Data Transform for sorting the Data Page.

Activity Rule - Steps Tab - ShowPhoneOrderSection - Apply-DataTransform

  • The step page is referring to a page that is defined on Pages & Classes. This entry is needed because the Data Transform’s applies-to class is different than that of the Activity, which is PGX-MyStore-Work.

Activity Rule - Pages and Classes Tab - ShowPhoneOrderSection

  • When the Activity is run again, the options in the phone dropdown control are now sorted by Name in ascending order.

Section Rule - Runtime - Phone Dropdown Options Sorted by Name in Ascending Order

  • Another Data Transform was created to sort the phone list by Memory (ASC) first and then by ScreenSize (DESC). The configuration is shown below.
  • If two or more phones have the same amount of memory, they will be sorted by screen size in descending order, i.e. the one with the largest screen size will be on top in that subset of the list.

Data Transform Rule - Definition Tab - Sorting Properties - Sort By Two Proerpties, Memory and Screen Size

  • The Data Transform can be run by using Actions > Run.
  • In the Run Data Transform dialog, click on the Trace button first and the on the Run button.

Data Transform - Trace and Run Buttons - SortByPhoneMemoryAndScreenSize

  • In the Tracer, where the event type is Action End click on the cell that lists the Data Page, here D_PhoneList, to view the Data Page after it has been sorted by the Data Transform.

Data Transform Rule - Use Tracer to View Data Transform and Data Page

  • The dialog lists the items of D_PhoneList.pxResults.

Tracer - View Properties on Data Page D_PhoneList

  • The phones are sorted in ascending order by memory first. In addition, the phones with 16GB of memory are sorted in descending order by screen size.