Links may not function; however, this content may be relevant to outdated versions of the product.
Using Data Transforms in Flow Actions
With a data transform, you can easily copy, map, and transform clipboard data values from one clipboard page to another. For example, you can set the default value of “Full Time” for the employment type of any new hire. This can be changed in the user interface later, if needed.
You can also use a data transform for updating property values on a page using properties from another existing page. For example, the billing address and shipping address in online purchases are likely the same. A data transform can read property values from one page, such as the billing address, and copy those properties to another page – in this case, to the shipping address.
This article presents a sample Travel application to demonstrate how data transforms can be used in a flow action.
Design requirements
In this example, a trip case is processed in a screenflow, which comprises four assignments. When the user first completes the Traveler Info form and submits it, the system creates the trip and proceeds to the Event form.
The application's business analyst has defined two requirements that must be met when a trip reaches the form.
Requirement 1
The system must create a default event named "Pegaworld 2015" and populate the Event form's four values when the form is rendered, as shown here:
If the user deletes the default event and returns to the Traveler Info form, the event must not be created again. For example, if the user deletes PegaWorld 2015, adds another event, returns to Traveler Info to update the email address, then advances to Event again, the form does not contain the Pegaworld 2015 event.
Requirement 2
Selecting the check box at the beginning of the row in the Event form indicates that a flight and hotel are to be booked for the event. The requirement states that when the user submits the form, the Location, Start Date, and End Date values must be displayed in their respective fields on the Flights form, as shown here:
How to implement requirements
You implement the requirements in two major steps:
- Create two data transforms that do the following:
- The first transform creates and populates an event on the Event form before it is rendered.
- The second transform populates the event information entered by the user on the Flight form after submitting the Event form.
- Associate the data transforms with the Event flow action.
Step 1. Create two data transforms
Create the following data transform records in the Trip case type. In this example, the four properties on the Event form (Event, Start Date, End Date, and Location) are in a page list named Event, which refers to a data page named D_EventList.
Create the PopulateEvent transform
The Definition tab on the data transform is configured as shown here.
Rows 1 and 1.1 state that the transform runs only when the select event is accessed for the first time and there are no events defined.
When run, the results of D_EventList set the values on the case work page. For example, when the user advances to the Events form and the transform runs, the data page on the Clipboard looks like this:
The case's work page contains the values set by the transform.
Create the SetEventDetails transform
The Definition tab on the data transform record is configured as shown here:
As shown in row 1.1, when the check box is selected (pySelected==true), the transform sets the Destination, EndDate, and StartDate values on the Flights form using the values on the case's work page.
Step 2. Add the transforms to the Enter Trip Information flow action
In the Enter Trip Information flow action (which renders the Event form) on the Action tab, do the following:
- Enter transform PopulateEvent in the Pre-Processing section, which is invoked before the system renders the Event form.
- Enter transform SetEventDetails in the Post-Processing section, which is invoked before the system renders the Flights form.
The completed tab looks like this: