Using the Sub Data Flow component
3 Tasks
20 mins
Beginner
Pega Platform '24.2
English
Scenario
In the Sample application, the 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
Challenge Walkthrough
Detailed Tasks
1 Create the Assign IDs to Invoices Data Flow
- Log in as the system architect:
- In the User name field, enter SystemArchitect.
- In the Password field, enter rules.
- In the navigation pane of Dev Studio, click App to open the Application Explorer.
- In the Application Explorer, search for the Sample-Data-Invoices class.
- In the Application Explorer, right-click on the Sample-Data-Invoices class, then select Create > Data Model > Data Flow.
- On the Create Data Flow rule form, create a new Data Flow:
- In the Label field, enter Assign IDs to Invoices.
- In the upper-right corner, click Create and open.
- On the Edit Data flow: Assign IDs to Invoices rule form, configure the following settingsconfigure the following settings:
- On the canvas, double-click on the first shape to set up the source configurations.
- In the Source list, select Data set.
- 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.
- Click Submit.
- On the canvas, on the first shape, click Add > Sub Data Flow to add a Sub-data Flow component:
- On the canvas, double-click the unconfigured (- -) component to set up the Sub-data Flow configurations:
- 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.
- In the Data flow list, enter or select GenerateUniqueIDs.
- Click Submit.
Tip: Note that the Sub-data Flow is in the Sample-Data class. When the component is configured, the destination component is updated accordingly. To save the results in the Sample-Data-Invoice class, use the Convert component.
- In the Run sub data flow on, select Current page.
- On the canvas, on the Generate Unique IDs component, click Add > Convert to add a convert component:
- On the canvas, double-click the empty - - convert component to set up the convert configurations:
- In the Convert configurations, configure the following settingsconfigure the following settings:
- In the Convert page on Sample-Data field, ensure that Top-level is selected.
- In the Into page(s) of class, enter or select Sample-Data-Invoices.
- In the Field mapping section, select the Auto-copy properties with identical names checkbox.
- Click Add mapping to map the UniqueID with InvoiceID.
- In the Target (Sample-Data-Invoices) column, enter or select .InvoiceID.
- In the Source (Generate Unique IDs) column, click the Gear icon to build an expression.
- In the Expression builder window, enter "INV-" + .UniqueID.
- Click Submit.
- Click Submit.
- On the canvas, double-click the last component to set up the destination configurations:
- In the Destination configurations, configure the following settings:
- In the Destination list, select Data set.
- In the Data set field, enter or select Invoices.
- In the Save options, ensure that Save full record is selected.
- Click Submit.
- In the upper-right corner, click Save.
2 Preview the records in the Data Flow
- On the Data flow: Assign IDs To Invoices rule form, right-click the Generate Order Data component and then select Preview.
- Browse through the Results() to preview the data generated by the Generate Order Data Monte Carlo Data Set.
- Close the Input Data Preview window.
- Browse through the Results() to preview the data generated by the Generate Order Data Monte Carlo Data Set.
- On the Data flow: Assign IDs To Invoices rule form, right-click the Generate Unique IDs Sub-data flow component and 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.
- Browse through the Results() to preview the data generated by the Sub-data Flow. Note that the UniqueID field is now populated.
- Close the Input Data Preview window.
- Browse through the Results() to preview the data generated by the Sub-data Flow. Note that the UniqueID field is now populated.
- On the Data flow: Assign IDs To Invoices rule form, right-click the Sample-Data-Invoices convert component and then select Preview.
- Browse through the Results() to preview the data generated by the convert component.
Note that the InvoiceID field is now populated. - Close the Input Data Preview window.
- Browse through the Results() to preview the data generated by the convert component.
3 Run the AssignIDs to Invoices Data Flow
- On the Data flow: Assing IDs to Invoices rule form, in the upper-right corner, click Actions > Run.
- On the New: Data Flow Work Item page, review the settings and then, in the upper-right corner, click Submit.
- On the Data Flow Run page, in the upper-right corner, click Start.
- Confirm that the Data Flow run is successfully completed, and then, above the progress bar, click AssignIDsToInvoices.
- On the Data flow: Load Patients and Policies rule form, right-click the Invoices Data Set, then select Open data set.
- On the Data set: Invoices rule form, in the upper-right corner, click Actions > Run to open the Run Data Set: Invoices window.
- In the run context window, in the Operation list, select Browse.
- In the upper-right corner of the run context, click Run.
- Browse through the Results() to confirm that the data is successfully saved.
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?