More about data transforms
Using a data transform, you can specify initial properties for objects of a specific class and also map properties (and their values) of an instance of a class to an instance of a different class.
For example, you can ensure that a special set of risk-related properties is present on all instances of class Data-Loan-Aircraft-SingleEngine. When a page of this class is created, you can instruct the system to apply a data transform, named Aircraft-High-Risk. The system places into the page the risk-related properties defined in the data transform. When the page is later saved into the database as a persistent instance, the properties are present with meaningful values.
Typically, you use the actions within a data transform to update and apply data to clipboard pages. Additionally, there are four activity methods that can optionally use a data transform as a parameter:
- Apply-DataTransform — Updates existing clipboard pages with values computed from a data transform.
- Page-New — Creates a new named page of a specified class. If a data transform is specified in this method, the data transform's actions are applied to the page.
- Page-Copy — Copies the contents of a clipboard page to a new named page or replaces the contents of an existing page. If a data transform is specified in this method, the data transform's actions are applied to the destination page before the source's contents are copied.
- Page-Change-Class — Creates a new page of the specified class, and then copies properties from another page into it, according to the method's Keep parameter and the specified data transform (if any).
The Apply-Model method is deprecated in version 6.2, and replaced by the
Apply-DataTransform method. To use the Apply-DataTransform method to achieve the same result
of using the Apply-Model method with the OverwriteProperties parameter set to
'false'
, use When actions in the data transform to prevent values from
being applied when properties are already present on the target page. For example:
When !@PropertyHasValue(.FirstName)
Set .FirstName = "Bob"
In the preceding example, when the
FirstName
property has a value, the
condition is not satisfied and the Set action is skipped.
Service rules ( Rule-Service- classes) and a few other rule types can reference a data transform. The data transform is processed and applied at runtime to a newly created page.
Viewing the Java code of a rule
Click
to view the generated Java of a rule. You can use the Java code to debug your application or to examine how rules are implemented.Changing the value of a TimeOfDay property
When you use an expression on TimeofDay property type values, the expression converts the value into a BigDecimal where the whole number is the number of days and the fraction is the hour of the day expressed as a fraction of a day, for example, 12 hours is 0.5 (half of a day). The format is useful to know when you want to change the value of a property that is a Date, DateTime, or TimeofDayproperty type.
- Use a Set action to assign the property value to a second property that is of type TimeofDay.
- On the right side of the expression, enter the property reference plus the fraction. In this example, enter .5 to add 12 hours.