Skip to main content

Using the Sub Data Flow component

3 Tasks

20 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, Sample-Data-Invoices class is created for processing invoice data with the following data structure.

Field Type Description

InvoiceID

Identifier

Unique identifier for Invoice records

OrderID

Text

The order identifier associated with the invoice

DueDate

Text

The phone number of the patient

Status

TrueFalse

Is the patient in collections?

Amount

TrueFalse

Is the patient deceased?

The developers have created a new Data Flow, GenerateUniqueIDs, as a reusable Data Flow in the Sample-Data class.

As the System Architect, you are asked to create a new Data Flow that utilizes the GenerateUniqueIDs Data Flow to assign a UniqueID to each InvoiceID with the prefix "INV-".

For the purposes of this exercise, the following artifacts are created for you:

Rule Type Description

GenerateOrderData

Monte Carlo Data Set

Creates random order data that will be used for the invoice details.

Invoices

Decision Data Store Data Set

A Decision Data Store Data Set that is created to store the invoice data after populating the InvoiceID.

GenerateUniqueIDs

Data Flow

A Data Flow created in the Sample-Data class, that generates unique ids and sets the UniqueID field.

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 Assign IDs to Invoices Data Flow

Create a new Data Flow in the Sample-Data-Invoices class, named Assign IDs to Invoices.

  • Use the pre-configured GenerateOrderData Monte Carlo Data Set as the source Data Set.
  • Use the GenerateUniqueIDs as a Sub-data Flow to populate a UniqueID for each record.
  • Use a Convert Shape to change the class from Sample-Data to Sample-Data-Invoices and map the UniqueID to the InvoiceID. Append each InvoiceID with the prefix:"INV-"
  • Use the pre-configured Invoices Decision Data Store Data Set as the destination Data Set.

Task 2: Preview the records in the Data Flow

Test the Data Flow to confirm that UniqueID is getting generated for each record.

Note: For the purposes of this exercise, the SampleData File Data Set is created for you in the Sample-Data class.

Task 3: Run the Assign IDs to Invoices Data Flow

Run the Assign IDs to Invoices Data Flow with the default settings and validate the final records in the Invoices Decision Data Store 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 Assign IDs to Invoices 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-Invoices class.
  4. In the Application Explorer, right-click on the Sample-Data-Invoices class, then select Create > Data Model > Data Flow.
  5. On the Create Data Flow rule form, create a new Data Flow:
    1. In the Label field, enter Assign IDs to Invoices.
    2. In the upper-right corner, click Create and open.
      Create and open
  6. On the Edit Data flow: Assign IDs to Invoices rule form, complete the following settings:
    1. On the canvas, double-click on the first shape to set up the source configurations.
    2. In the Source list, select Data set.
    3. In the Data set field. enter or select GenerateOrderData.
      Note: For the purposes of this exercise, the GenerateOrderData Monte Carlo Data Set that generates random order data is preconfigured.
    4. Click Submit.
      Submit
  1. On the canvas, on the first shape, click Add > Sub Data Flow to add a Sub-data Flow component:
    Add
  2. On the canvas, double-click the unconfigured (- -) component to set up the Sub-data Flow configurations:
    Add 2
    1. In the Run sub data flow on, select Current page.
      Tip: To process records in the Data Flow on the current page, select the Current page option. To loop over items in a page list property defined on the current page and save the results in that property, select A page list, and then in the Page list property field, select the Page list property.
    2. In the Data flow list, enter or select GenerateUniqueIDs.
      GenerateUniqueIDs
    3. Click Submit.
      Submit 2
      Tip: Note that the Sub-data Flow is in the Sample-Data class. Once the component is configured the destination component is updated accordingly. To save the results in the Sample-Data-Invoice class, use the Convert component.
  1. On the canvas, on the Generate Unique IDs component, click Add > Convert to add a convert component:
  2. On the canvas, double-click the empty - - convert component to set up the convert configurations:
  3. In the Convert configurations, complete the following settings:
    1. In the Convert page on Sample-Data field, ensure that Top-level is selected.
    2. In the Into page(s) of class, enter or select Sample-Data-Invoices.
    3. In the Field mapping section, select the Auto-copy properties with identical names checkbox.
    4. Click Add mapping to map the UniqueID with InvoiceID.
    5. In the Target (Sample-Data-Invoices) column, enter or select .InvoiceID.
    6. In the Source (Generate Unique IDs) column, click the gear icon to build an expression.
      gear
    7. On the Expression builder window, enter "INV-" + .UniqueID.
    8. Click Submit.
      UniqueID 2
  4. Click Submit.
  5. On the canvas, double-click the last component to set up the destination configurations:
  6. In the Destination configurations, complete the following settings:
    1. In the Destination list, select Data set.
    2. In the Data set field. enter or select Invoices.
    3. In the Save options, ensure that Save full record is selected.
    4. Click Submit.
      Submit 3
  7. In the upper-right corner, click Save.

2 Preview the records in the Data Flow

  1. On the Data flow: Assign IDs To Invoices rule form, right-click the Generate Order Data component then select Preview.
    1. Browse through the Results() to preview the data generated by the Generate Order Data Monte Carlo Data Set.
      Results 23
    2. Close the Input Data Preview window.
  2. On the Data flow: Assign IDs To Invoices rule form, right-click the Generate Unique IDs Sub-data flow component then select Preview.
    Tip: To be able to use the Sub-data Flow component in a Data Flow, the primary source and the first destination of the Sub-data Flow must be abstract.
  3. Browse through the Results() to preview the data generated by the Sub-data Flow. Note that the UniqueID field is now populated.
  4. UniqueID 5
  5. Close the Input Data Preview window.
  6. On the Data flow: Assign IDs To Invoices rule form, right-click the Sample-Data-Invoices convert component then select Preview.
    1. Browse through the Results() to preview the data generated by the convert component. Note that the InvoiceID field is now populated.
      InvoiceID
    2. Close the Input Data Preview window.

3 Run the AssignIDs to Invoices Data Flow

  1. On the Data flow: Assing IDs to Invoices rule form, in the upper-right corner, click Actions > Run.
  2. On the New: Data Flow Work Item page, review the settings than, 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 is successfully completed, then above the progress bar, click the AssignIDsToInvoices link.
    InvoiceID 2
  5. On the Data flow: Assing IDs to Invoices rule form, right-click the Invoices Data Set, then select Open data set.
  6. On the Data set: Invoices rule form, in the upper-right corner, click Actions > Run to open the Run Data Set: Invoices window.
    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 through the Results() to confirm, the data is successfully saved.
      Results 5


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