Data Transforms Flashcards
What is Data Transform
Data Transforms are part of the Data Model category and are instances of the “Rule-Obj-Model” rule type. akes data manipulation on properties and pages easy and efficient.
Data Transforms map data from a source to a target, performing any required conversions or transformations on that data. The source could be one case such as a purchase request case and the target could be another case, such as a purchase order case.
In which cases Data Transform is the most appropriate to use?
- to set default values
- updating property values on a page using properties from another existing page
- to append a new or existing page to a page list or to append and map properties from one page to another page
- To set default values for the properties defined on a clipboard page.
- To copy one clipboard page to another clipboard page.
- To map properties defined on one page to another page.
- To append properties from one page list property to another page list property.
- To iterate over pages in a page list property to map data on each page.
In which cases Data Transform is not the best solution?
- A property value should be set declaratively, rather than procedurally. To set a property value declaratively, use a declare expression rule instead.
- When defining source data for a data page. Depending on the source of the data use of a report definition, database lookup, or activity may be more appropriate.
- Updating data in a database. Data transforms do not provide any means to write data to a database.
What are the settings tabs for a Data Transform?
- The “Definition” tab is where we define the actions to be taken. They are presented as a sequence of rows in a tree grid.
- The next tab is the “Parameters” tab. On the Parameters tab we can list the variables that input data to, or return data from the Data Transform. Variables defined here are referenced on the “Definition” tab by the notation Param.ParamName.
- We use the “Pages & Classes” tab to specify the pages referenced on the fields of the “Definition” tab.
Call superclass data tranform?
Finds all data transform in the Pattern and Directed hierarchy and runs all. Highest in hierarchy will be run first lower levels will overwrite the same property.
Data transforms can be chained with other data transforms defined in their parent classes. To do this, we need to enable the “Call superclass data transform?” checkbox, and the data transforms must share the same name.
PRPC checks for the same name in all the parents of this class following both pattern and directed inheritance. Then it applies all the data transforms starting with the deepest ancestor continuing for each child upward.
This is a powerful feature to set default values for the properties at the appropriate level.
Columns on the Definition Tab?
Action – This is where we identify what the step is for. This is required for each step. We will look at the different actions that are possible shortly.
Target – Most actions require a target. In cases where an action is not required, we cannot select one. The smart prompt box acts both as a select and a text box. We can select a property from the list or we can type text.
Relation – This is an optional column. The typical relationship between source and target is “equal to.” There are a few actions that use other relationships.
Source - This becomes selectable only if the action requires a source. We can specify literal value, properties or expressions. We can, for example, set the target property “Employment Type” as the value “Full Time,” target property the “Full Name” as concatenation of two other properties “First Name” and “Last Name,” and target property “Rate” as an expression, namely, the sum of source properties “BaseRate,” “LoanRateAdjustment,” and “RiskRateAdjustment.”
Best Practices
- do not create more than 25 steps
- if you have more, group them into another Data transform
Available Actions?
Set - is used to set the target from a source. We can set a value to a Single Value property which exists in the top-level page such as the pyWorkIDPrefix or in an embedded page such as the LoanType in the LoanInfo page.
Remove - is used to delete the target and any associated values from the clipboard.
Update Page - is used to set the properties defined on an embedded page. When we use Update Page we need to set individual properties using the Set action with the nested rows after the row with “Update Page.” In fact, we have the option of selecting any of the actions shown above for the nested rows below the “Update Page” row.
Apply Data Transform. - We can reference another data transform rule from our existing data transform rule. This might occur if we are going over 25 steps and want to break the rule into smaller manageable data transforms. Or we might have a reusable data transform, such as one for initializing a case with some default values.
Conditional Actions - to perform steps based on a condition:
• When — To conditionally perform actions.
• Otherwise When and Otherwise — To provide actions for the alternative to the When actions.
“Append to” action to copy a page from the source to the target. For instance, if we want to add a new page to the Assets page list, we can select new page. We can also add another existing page or copy all the pages from another pagelist, by selecting the appropriate values in the drop down in the relation column.
“Append and Map to” is used to map individual properties in the page list. When we select this action, at least one nested child column is used with “Set” action.
For Each Page In - iterate over a pagelist. Using this action we are able to apply the change for all the child nested rows of the page list.
“Exit For Each” - If we don’t want to loop through all the pages in the pagelist, we can exit the loop
“Exit Data Transform” - Exit from processing all the remaining steps, Typically, we have these steps after a when condition.
Available Symbolic Indexes?
CURRENT: Identifies the index of the current iteration
APPEND: Inserts the element at a new position at the end
LAST: Retrieves the highest index
PREPEND: Inserts the element at the top
INSERT: Inserts the element at a specific position that is indicated by the number
Param.pyForEachCount VS. CURRENT
Param.pyForEachCount – Same as CURRENT. Identifies the index of the current iteration. This can be used for the Page index and in the expression as well, while can be used only for the Page index.
Where can you use/not use ?
For Data Transform rules, we cannot use the APPEND keyword in the For Each Page In action. Instead, we need to use “Append” or “Append and Map” actions.
We can use APPEND for “Update Page” action in the Data Transform and also for looping through in the steps of an Activity rule.
Additional reference keywords?
Top – Refers the top most page of the embedded page.
Parent – Refers to the parent page of the embedded page. If the embedded page has only one parent, and no grandparents in the hierarchy, Top and Parent refer to the same parent page.
Where Data Transforms can be used/invoked?
- pyStartCase - In the starting processes of a case, the data transform rule (pyDefault) is defined on the Processes tab, which is invoked to set initial properties for the case instances. The starting process has the “Creates a new work object” setting selected.
- Propagate data to a subcase - If we are simply taking the data without making any changes, we can use the data propagation option and we do not need to select “Also apply Data Transform.” If we are using the data conditionally or looping through a pagelist or if we need to reuse propagating data from parent to subcase in other rules, we can use the “Also apply Data Transform,” option and use a Data Transform rule.
- We can also use a Data Transform rule in a step where a subcase is instantiated from the case designer of the parent case. We propagate the data this way if we don’t want to take advantage of propagating the data from Case Designer “Data Propagation” configuration. Let’s say, we are creating “Inventory Selection” step in two steps of different stages in the “Purchase Request” case, and in those steps, the data that needs to be propagated is different. In this scenario, we need to reference the different data transform rules in the step configuration, instead of relying on the one data transform rule referenced in the data propagation settings in the details tab of the case designer of the parent case. The example shown here is using “CopyLineItemsPO” data transform when creating multiple subcase instances of the Purchase Order case in the step configuration of “Create Orders” step of “Purchase Request” case stage design.
For each step, there is an appropriate flow rule associated with it. A step of step type “Case” uses the “Create Case(s)” smart shape in the flow rule for that step. Referencing a data transform on step configuration is the same as setting the properties on the smart shape in the flow rule. We can modify it in either place and it is reflected in the other place.
4 - In flows, on any connector between any two shapes, we can set properties or referencedata transform rules. If it is a simple setting of one or two properties, we can use “Set Properties.” But, If we are using data conditionally or looping through a page list or if we need to reuse the data transform in other places, we can use the “Also apply Data Transform,” option and use a Data Transform rule. For example, when the flow is processed on a decision shape, on the connectors, we can use the appropriate data transform rules based on the decision made by the end user.
5 - In Flow Actions - In Flow actions, we can specify a data transform on the flow action’s Action tab. To populate the properties from another page, we can invoke a data transform in the “before this action” area. If we want to copy the values submitted in the user session to another page, then we can invoke “after the action” is submitted.
6 - for a cell in a section rule - one of the change event is Other: Run data transform
7 - for a cell in a section rule - “Refresh This Section” action is selected for a change event: a DT or an Activity can be triggered
Data Transform evaluation order?
- First, the application applies the Data Transform on the starting flow of the subcase
- Next, the application applies the data propagation and Data Transform configured on parent case type rule (defined on Case Designer – Details tab)
- Finally, the application applies the Data Transform defined on the case instantiation step in the Case Designer of the parent case, or the Data Transform defined in the “Create Case(s)” smart shape in the “create case” flow rule of the Parent case.