The new Branch, Convert, and Data Transform shapes extend the functionality of data flows in your application.
By adding this shape in a data flow, you can create additional destinations. As the data enters the Branch shape, it splits into multiple paths that are processed independently. You can modify the data that is saved in each destination by adding branch-specific shapes in the connectors that radiate from the Branch shape.
You can branch a data flow by clicking Add destination on a Destination shape. If you create the first branch, the following shapes are inserted:
- A new Destination shape
- A Branch shape that precedes the Destination shapes and radiates connectors that lead to all Destination shapes
Creating branches in a data flow
In addition to creating branches, you also can add processing instructions that apply only to a specific branch in a data flow. These instructions are applied in the form of Convert, Data Transform, and Filter shapes that you can add to each outgoing connector from the Branch shape
Data flow with branch-specific shapes
Branching a data flow to write results into multiple destinations
You create multiple branches in a data flow to create independent paths for processing data in your application.
- In Designer Studio, click Resources > Data Model > Data Flow.
- Click the Data Flow rule to branch.
- On the Data Flow tab, locate the Destination shape and click Add destination.
- In the new data flow branch, right-click the new Destination shape and select Properties.
- In the Output data to section, expand the Destination drop-down list and select the destination rule type:
- Data flow
- Data set
- Depending on the destination rule type, select the rule of that type to become a destination in this Data Flow rule or create a rule by clicking the Open icon.
- Click Submit.
- Optional: Click the branch and select Convert, Data Transform, or Filter to apply additional processing to the data in the new branch. These shapes are specific only to the branch on which they are added and do not influence data processing on other branches in the Data Flow rule. You can add multiple branch-specific shapes in a single branch.
- Optional: Repeat steps 1 through 8 to create additional branches in the Data Flow rule.
Data Transform shape
You can use the Data Transform shape in a data flow to perform complex transformations of your decision management data. To configure this shape, you reference a data transform in the same class as the incoming data or in a class in the inheritance path of the data flow. The Data Transform shape passes the input data to the data transform and propagates the results to the next shape in the flow.
Use case: Transforming data before merging
The following use case combines records that contain customer data with records that contain customer transactions. These records are sourced from different data sets and have a different structure. To implement this use case, you can design a data flow that references a Data Transform shape, as shown in the following example:
Data flow that references a Data Transform shape
The records in theIncomingRecord data set contain the values for CustomerID and PurchaseID properties only. The structure of each record is flat (that is, the properties are not embedded). To structure the data and to enable merging of records, a data transform is applied. The data transform that is referenced in the Structure PurchasesData Transform shape has the following configuration:
A data transform that converts a single-page structure to a page list with embedded properties
The preceding data transform rule places the CustomerID property in the top-level clipboard page and embeds the PurchaseID property in the Purchases clipboard page, as shown in the following example:
Structure of records before and after the data transform
Further in the sequence of shapes in the data flow, a Merge shape combines the incoming transaction records with the customer records. The condition is that both records must have the same CustomerID property to be merged.
Merging transformed data
Additionally, the merged records can be enriched with the information about other transactions (through the Compose shape) before being emitted to the destination data point. The additional purchases are part of the Purchases page.
Convert shape with the unpack functionality
The Convert shape now supports page unpacking. By using this new functionality, you can extract pages from the incoming page list properties. The extracted pages can be converted to other classes and propagated further in the sequence of the data flow. When you use the Convert shape, the source page list is preserved so that you can extract, convert, and propagate only values of the properties that are relevant to a particular use case or data set type.
Use case: Saving the strategy results in the interaction history
The example use case has the following goals:
- Design a data flow to write the full outcome of a strategy into a data set. The records must consist of customer data with the embedded propositions that were offered.
- Use the same data flow to save the offered propositions to the interaction history. The records that are saved must belong to the Strategy Result (SR) class.
To achieve these goals, a single data flow that references a Convert shape is used, as shown in the following example:
Convert shape in a data flow
The data flow in the example contains the Branch shape to separate the flow of data into distinct branches. The primary branch leads to the Customer data set where the full outcome of the strategy is written. This destination does not require any branch-specific shapes to modify the data before it is propagated. The Interaction History data set, however, must meet the following data requirements:
- Only the strategy results (that is, the propositions that were offered) are required
- The data must belong to the SR class
To meet these requirements, you can insert a Convert shape in the branch that leads to the Interaction History data set. This shape has the following configuration:
Properties panel of the Convert shape
The Convert shape extracts the OfferedPropositions property that contains the strategy results, converts the data to the SR class, and propagates the results to the Interaction History data set. The unpacked results can be viewed on the clipboard.
Strategy results unpacked with the Convert shape