Data access patterns
Data access patterns
Data access patterns provide simple mechanisms to manage data in a Pega Platform™ application effectively. Pega Platform supports three data access patterns for use in applications. The choice of data access pattern impacts the storage and refreshing of data in a case.
- The system of record pattern provides access to data stored in another system or application. The application always references the system of record, so the data is always current.
- The snapshot pattern copies data into the case. The application always references the copied data, so the data is only current as of the time the application copied the data.
- The reference pattern allows an application to use data without adding that data to the data model for the application. The reference data pattern is used often to populate UI controls, such as drop-down lists. The value selected by the user is copied to the case.
System of record pattern
Use the system of record (SoR) pattern when you always need to reference the most current data from an external system or application. The case does not contain a copy of the data. Instead, the application references the data from the source when needed.
The SoR pattern helps to ensure that the data displayed in the Pega application is current. For example, if an account holder has a new phone number, the updated number is displayed when the data is accessed from the case.
Usage
To implement the SoR pattern on a property, in the Data Access section of the property record, select the Refer to a data page option. The type of property (page or page list) must correspond to the structure of the data page (page or list). A new data page is created on the first reference to the property.
Data is not stored in the property that refers to the data page. The property only contains a reference to a data page, as illustrated in the following screen shot of the clipboard.
Reloading data with the SoR pattern
With the SoR pattern, the data reloads according to the refresh strategy specified on the data page. The property always points to the current version of the data page.
Whenever a data page parameter is updated, a new data page is created. The property then points to the new page.
Snapshot pattern
Use the snapshot pattern when you need to copy data to a case at a specific point in time. Once you copy the data to the case, the data is not retrieved from the source again unless the request parameters change.
For example, when a user creates an insurance claim, the application copies insurance coverage information to the claim from an external system. Each time the case is opened, the insurance coverage information recorded in the case remains unchanged.
Usage
To implement the snapshot pattern on a property, in the Data Access section of the property record, select the Copy data from a data page option. The type of property (page or page list) must correspond to the structure of the data page (page or list).
The first time the property is referenced, the data page is created, and the data is copied to the property. You may also choose to specify a data transform for data mapping in Optional data mapping.
Reloading data with the snapshot pattern
When you copy data from a data page, the data is stored in the property. The data page is not accessed again unless it has a parameter that changes. When the parameter changes, a new data page is created. The impacted data is copied to the property and overwrites the existing data.
Reference pattern
Use the reference pattern to populate UI controls with dynamic data. When you use the reference pattern, only the selected value is copied to the data model of the case. For example, you can use the reference pattern to populate countries and states in drop-down lists.
Usage
To implement the reference pattern, reference a data page from a record other than a property. The following example demonstrates populating a drop-down control with values from a data page. The application creates the data page the first time the property is referenced.
Tipp: If the data page contains information that applies to multiple cases, you can set the page scope to node to save memory by sharing the contents of the data page between requestors.
Reloading data with the reference pattern
With the reference pattern, the data reloads according to the refresh strategy specified on the data page. The control always points to the current version of the data page.