![Example of how data transforms are used in a checkout example](https://demo5-academy.pega.com/sites/default/files/styles/1024/public/media/images/2021-02/data-transform-checkout-example.png?itok=COxNl8aq)
Data Transforms
Data transforms
The purpose of a data transform is to manipulate data in an application. Data transforms copy or manipulate data into the form you require. Data transforms can be used to convert data from one type to another, iterate over page lists, or page groups and copy entire pages at a time.
Consider the checkout process of a purchasing application. The customer provides a shipping address and is prompted to provide a billing address. The billing address and shipping address are likely the same. It is more efficient to use a data transform to copy the shipping address to the billing address rather than have the customer reenter the shipping address. Further, into the checkout process, the customer must provide their full name for credit card processing. Use a data transform to copy the first name and last name properties from the customer account into a single full-name property.
You can use data transforms to convert data from one type to another type. For example, to complete the checkout process in the purchasing application, the customer must provide their card number in the payment gateway. Use a data transform to copy and convert the stored string format credit card information into the card number property.
Nota: To convert the string into a number, open the expression builder, click the Configure icon, and use the out-of-the-box (OOTB) functions available in Pega Platform™. In the credit card number example, you can use the toInt() function.
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.
Consider another example. An auto repair parent case has a child case that handles providing the necessary repairs. The child case contains a menu of possible items and services that can be provided, 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 only copy those entries with a quantity greater than zero.
Tip: When accessing information in different cases (for example, in a parent-child case relationship), consider referencing data from the parent case rather than copying information from the parent case to the child case. Reference data to avoid synchronization issues if data changes on the parent case.
Check your knowledge with the following interaction.
This Topic is available in the following Module:
If you are having problems with your training, please review the Pega Academy Support FAQs.
¿Quiere ayudarnos a mejorar este contenido?