Skip to main content

Converting the class of incoming data

4 Tasks

25 mins

Visible to: All users
Beginner Pega Platform English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Scenario

In the Sample application, two entities exist for storing patient data and their corresponding health policy data, where one patient may have multiple health policies.

  1. Sample-Data-Patients has the following Data Model. To access the data, the Patient database table Data Set is avaliable for you.
    Field Type Description

    PatientID

    Identifier

    Patient identifier

    FullName

    Text

    Full name of the patient

    Phone

    Text

    The phone number of the patient

    IsInCollections

    TrueFalse

    Is the patient in collections?

    IsDeceased

    TrueFalse

    Is the patient deceased?

    HasCriticalIllness

    TrueFalse

    Does the patient have a critical illness?

    Age

    Integer

    Age of the patient

    Address

    Text

    Address of the patient

    Policies

    PageList

    Page-list property of type Sample-Data-Patient

    Note: The Policies field is not part of the database table. The field is a Page-list property that points to the Sample-Data-Policy class.
  1. Sample-Data-Policy has the following Data Model. To access the data, the Policy database table Data Set is available for you.
    Field Type Description

    PolicyID

    Identifier

    Policy identifier

    PatientID

    Text

    Patient identifier

    PlanType

    Text

    Healthcare plan type

    PlanName

    Text

    Healthcare plan name

    RenewalDate

    DateTime

    Renewal date of the policy

The Patient and Policy tables currently have no data in them, and you are tasked with loading sample data into both tables.

For your convenience, the System Architect created a Data Flow in the Sample-Data-External class called PatientsAndPolicies that uses a Monte Carlo Data Set to populate sample data. The Sample-Data-External class is where System Architects typically generate, load, and manipulate external data.

Create a new Data Flow that uses the PatientsAndPolicies Data Flow to load sample data in the Patient and Policy database tables.

The Sample-Data-External Data Flow

Use the following credentials to log in to the exercise system:

Role User name Password
System architect SystemArchitect rules

Your assignment consists of the following tasks:

Task 1: Create the Load Patients and Policies Data Flow

Create a new Data Flow named Load Patients and Policies in the Sample-Data-External class.

Note: For the purposes of the exercise, the PatientsAndPolicies Data Flow is available for you to generate sample data that uses a Monte Carlo Data Set.

Use the PatientsAndPolicies Data Flow as the source of the Load Patients and Policies Data Flow, and then preview the data.

Task 2: Configure the Load Patients and Policies Data Flow

The Patient Data Set resides in the Sample-Data-Patients class, and the Policy Data Set resides in the Sample-Data-Policy class.

  • Use the Convert shape to change the class of the sample data from Sample-Data-External to Sample-Data-Patients. Use the Patients database table Data Set to save the values.
  • Add another branch to the Data Flow and save the Policies embedded page. Use the Policy database table Data Set to save the values.

Task 3: Preview the Records in the Data Flow

Preview the records in both convert shapes to verify that the properties have the correct mappings, and that each preview has the right records.

Task 4: Run the Load Patients and Policies Data Flow

Run the Load Patients and Policies Data Flow with the default settings and validate the final records in the Patients database table Data Set and Policy database table Data Set.

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Create the Load Patients and Policies Data Flow

  1. Log in as the System Architect:
    1. In the User name field, enter SystemArchitect.
    2. In the Password field, enter rules.
  2. In the navigation pane of Dev Studio, click App to open the Application Explorer.
  3. In the Application Explorer, search for the Sample-Data-External class.
    1. In the Application Explorer, right-click on the Sample-Data-External class, then select Create > Data Model > Data Flow.
  4. On the Create Data Flow tab, create a new Data Flow:
    1. In the Label field, enter Load Patients and Policies.
    2. In the upper-right corner, click Create and open.
      The Load Patients and Policies Data Flow
  5. On the Edit Data flow: Load Patients and Policies rule form, complete the following settings:
    1. On the canvas, double-click on the first shape to set up the source configurations.
      The source configurations for the Sample-Data-External Data Flow
    2. In the Source list, select Data flow.
    3. In the Input class field, enter or select Sample-Data-External.
    4. In the Data flow field, enter or select PatientsAndPolicies.
    5. Click Submit.
      The Source configurations dialog box
    6. In the upper-right corner, click Save.
  6. On the canvas, right-click the Patients and Policies Data Flow, and then select Preview to browse the results:
    1. In the Clipboard page: PreviewResult.pxResults(1) section, review the values for each property.
      The Clipboard page for Load Patients and Policies
    2. Click the + icon to expand the Results(1) page.
    3. Click the + icon to expand the Policies page.
    4. Click the + icon to expand the Policies(1) page.
      Policies1
    5. Browse through other Results.
      Note that each patient page contains one or more policies associated with it.

2 Configure the Load Patients and Policies Data Flow

  1. On the Data flow: Load Patients and Policies Rule form, in the upper-right corner, click Check out.
  2. On the canvas, on the first shape, click Add > Convert to add a new convert component:
    1. On the canvas, double-click the empty Convert component to set up the convert configurations.
      The Convert component
  3. In the Convert configurations dialog box, complete the following settings:
    1. In the Convert page on Sample-Data-External field, ensure that Top-level is the default value.
    2. In the Into page(s) of class, enter or select Sample-Data-Patients.
    3. In the Field mapping section, select the Auto-copy properties with identical names checkbox.
      Tip: If the field names differ between two data sources, you can manually add a field mapping to copy the value.
    4. Click Submit.
      The Convert configurations dialog box
      Note: The Sample-Data-External class converts to Sample-Data-Patients, and the system copies all properties automatically. When you use a Convert shape, it is possible to do additional mappings.
  1. On the canvas, double-click the last component to set up the destination configurations.
  2. In the Destination configurations dialog box, complete the following settings:
    1. In the Destination list, select Data set.
    2. In the Data set field, enter or select Patients.
    3. In the Save options section, select Insert new and overwrite existing records.
    4. Click Submit.
      The Destination configurations dialog box
  3. On the canvas, click Add branch on the last component to add a secondary destination.
    The Add branch option on the Patients shape
    Note: The system copies embedded Policies Page-list in Sample-Data-External to the Page-list in the Sample-Data-Patients class. You extract the data from this embedded page, convert it into the Sample-Data-Policies, and then insert it into the Policy data set.
  1. On the canvas, click the dotted line, and then select Convert to add another convert component.
  2. On the canvas, double-click the [Convert] component.
    The Convert component
  3. In the Convert configurations dialog box, complete the following settings:
    1. In the Convert page on Sample-Data-Patients section, select Embedded.
      Tip: This option enables you to select a Page or Page-list property defined on the primary page.
    2. In the Select page(list) field, enter or select .Policies.
    3. Click Submit.
      The Convert configurations dialog box 2
  1. On the canvas, double-click the empty (- -) component to set up the destination configurations.
    The empty component
  2. In the Destination configurations dialog box, complete the following settings:
    1. In the Destination list, select Data set.
    2. In the Data set field. Enter or select Policy.
    3. In the Save options section, select Insert new and overwrite existing records.
    4. Click Submit.
      dest config 1
    5. In the upper-right corner, click Save.

3 Preview the records in the Data Flow

  1. On the Edit Data flow: Load Patients and Policies Rule form, right-click the Sample-Data-Patients convert shape, and then select Preview to view the results:
    1. Browse the Results to confirm that the class successfully converted and that the properties have values.
      The results for the Sample-Data-Patients convert shape
    2. Close the Input Data Preview window.
      Note: The class Sample-Data-External is converted to Sample-Data-Patients and all properties are automatically copied. When using a Convert shape, it is possible to do additional mappings.
  1. On the Edit Data flow: Load Patients and Policies Rule form, right-click the Sample-Data-Policy convert shape, then select Preview to review the results:
    1. Browse the Results to confirm that the class successfully converted and that the properties have values.
      The results for the Sample-Data-Policy convert shape
    2. Close the Input Data Preview window.
  2. In the upper-right corner, click Check in.
  3. In the Check-in comments field, enter any comment, and then click Check in.

4 Run the Load Patients and Policies Data Flow

  1. On the Data flow: Load Patients and Policies Rule form, in the upper-right corner, click Actions > Run.
  2. On the New: Data Flow Work Item page, review the settings, and then, in the upper-right corner, click Submit.
  3. On the Data Flow Run page, in the upper-right corner, click Start.
  4. Confirm that the Data Flow run completed successfully, and then in the progress bar, click LoadPatientsandPolicies.
    The completed run for the Data Flow
  5. On the Data flow: Load Patients and Policies Rule form, right-click the Patients Data Set, and then select Open data set.
  6. On the Data set: Patients Rule form, in the upper-right corner, click Actions > Run to open the Run Data Set: Patients window, and then run the data set:
    1. In the run context, in the Operation list, select Browse.
    2. In the upper-right corner of the run context, click Run.
    3. Browse the results to confirm that the data updated successfully.
      The Clipboard page results for Patients Data Set
    4. Close the Data Set Preview window.
    5. Close the Run Data Set: Patients window.
  7. Close the Data set: Patients Rule form.
  8. On the Data flow: Load Patients and Policies Rule form, right-click the Policy Data Set, and then select Open data set.
  9. On the Data set: Policy tab, in the upper-right corner, click Actions > Run to open the Run Data Set: Policy window, and then run the Data Set:
    1. In the run context, in the Operation list, select Browse.
    2. In the upper-right corner of the run context, click Run.
    3. Browse the results to confirm that the data updated successfully.
      The Clipboard page results for Policy Data Set


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice