Data Transforms and default values
Data Transforms in Pega Platform™ convert source data in one format or class into target data of another format or class. Data Transforms are used to initialize, manipulate, map and transform data associated with a Case. In Dev Studio, you can call Data Transforms from a Process flow. You can also use Data Transforms to set default values for a property.
Calling Data Transforms in flows
By opening a Process in Dev Studio, you can call a Data Transform from a flow. In a flow, click the connector to open the Connector properties window. In the Set properties section, select Apply Data Transform as shown in the following figure:
Consider another example. An auto repair parent Case has a child Case that manages providing the necessary repairs. The child Case contains a menu of possible items and available services, including unit costs. The items and services that are provided are copied to the parent Case for invoicing. Use a Data Transform to iterate over the list of possible items and services and copy only those entries with a quantity greater than zero. The auto repair Case example is displayed in the following figures:
Data Transforms for default property values
The Data initialization page updates the pyDefault Data Transform. It is best practice to use the Data initialization page when possible and use the pyDefault Data Transform for more complex default values. The first time that you create a View for your Case Type, Pega Platform creates the pyDefault and pySetFieldDefaults Data Transforms. When you create a new Case, the pyDefault Data Transform is invoked to set the default values for that Case.
In the App Explorer, access pyDefault and pySetFieldDefaults Data Transforms as shown in the following figure:
For example, in the following image of the pyDefault configurations, the First Name (.FirstName) and Last Name (.LastName) fields are set to pyFirstName and pyLastName from the OperatorID Clipboard Page:
To reference the Data Page in the example above, you must add an entry to the Pages & Classes tab. The following image displays OperatorID Data Page added in the Pages & Classes tab:
Expressions can also be used to set a value in a Data Transform. For example, in the following image of the pyDefault configurations, the Date of Travel (.DateofTravel) field is set to the current date by using the @CurrentDateTime()
Function, and the Date of Return field is set to seven days from the current date through the @addCalendar(.DateOfTravel, "0", "0", "0", "7", "0", "0", "0")
Function:
Check your knowledge with the following interaction:
This Topic is available in the following Module:
Want to help us improve this content?