Skip to content

Create helper

You can create a helper with the i-refactory helper wizard or manually. We advise you to use the i-refactory helper wizard because this ensures that all necessary artefacts are created. When you add an i-refactory helper the following happens:

  • Mappings to the attributes are automatically created.
  • Attributes of related entities are automatically synchronized.

Meaning of 'Synchronized'

The helper attribute is a replica of the original attribute. If you change the datatype of the original attribute, the datatype of the replica will change as well.

It is also possible to disable the synchronization between the replica and original attribute. For example, if you want to change the data type of an attribute in the helper entity. In this case, you can desynchronize a replicated attribute.

When you use a helper, make sure that you follow:
* good practice about implementing calculations in the technical staging layer
* the good practice about implementing calculations within the context of the current delivery.

To create a helper:

  1. Right click on the table from which you want to create a helper.
  2. In the context menu, click on i-refactory > Helper Entity > Generate Helper Starting from this table.
    Generate helper
  3. The window Create Helper Entity... appears. You can configure the helper.
    Helper menu
  4. Helper Entity Name: name of the helper.
  5. Helper entity owner: select the correct owner.
  6. Traverse Reference Paths: when constructing a query from the starting point entity, should the reference paths be included?
    • If the box is unchecked, the query is constructed from one entity only.
    • If the box is checked, the query is constructed by joining entities using all the references connecting entities.
  7. Include Parent Primary Key Columns: should the primary key of any joint parent table be included in the select list of the query and helper entity?
  8. Click on OK. The helper entity appears in the diagram.
  9. Double click on the helper entity. A window Helper properties appears.
  10. Click on the tab Columns and assign one or more attributes as a primary key.
  11. If needed, add, or delete columns from the helper entity.
  12. If needed, adjust the helper query.
  13. Click on the tab IR derived entity.
    IR derived entity
  14. Click on OK.

Warning

If a SQL expression is incorrect in your query, you will get an error during the metadata import in the i-refactory or data retrieval from the database. The i-refactory server does not check whether a SQL expression is correct during a data delivery.

Create additional mappings

When you join two or more entities to create a helper, then you need to manually create mappings for these additional entities.

Tip

A helper must have mappings on entity level. It doesn't require attribute-level mappings.

To add a mapping to a helper:

  1. Click in the menu on Tools > Mapping Editor.... Mapping editor
  2. A window Mapping Editor appears
  3. Drag the relevant table in the source to the helper entity in the target.
  4. Click on OK

Example: how to create a helper

Suppose we want to implement a business rule for the order priority of an order:

  • If an European customer places the order, then the Order priority must be set to "2-HIGH".
  • Except when the customer is a French customer, in which case the order priority must be set to "3-MEDIUM".

This rule can be implemented with a helper entity. The helper starts from the ORDERS table. It will join with the parent tables NATION and REGION, to look up the country and the region of the order.

To add a business rule for the order priority of an order:

  1. Right-click on the ORDERS table. In the context menu, click on i-refactory > Helper Entity > Generate Helper Starting from this table.
  2. The window Create Helper Entity... appears
  3. Give the helper entity a clear name.
  4. Select an owner (the schema in the database).
  5. Set the check box Traverse Reference Paths to True. This will generate an "OASI style" view: the joins to the parent tables CUSTOMER, NATION, and REGION are automatically added to the helper query. Traverse Reference Paths
  6. Click on OK. The helper entity will be created with the following characteristics:
  7. A predefined query joining all parent tables. Notice that the query is wrapped inside a Common Table Expression named 'QRY'. Predefined query
  8. Predefined columns that are a PowerDesigner Replica of the column of the referenced source table. This has as advantage that the column in the helper entity will be renamed automatically when the source table column is renamed.
  9. A graphical representation of the dependencies (PowerDesigner Traceability Links) between the helper entity and the source tables referenced on the diagram. Graphical view of helper entity
  10. Generated mappings between the helper columns and the referenced source table columns. Mappings helper entity
  11. Edit the helper query as follows:
  12. Add a calculated column O_ORDERPRIORITY_CORRECTED to the SELECT list, and implement the rule.
  13. Remove all other columns except the columns of the Order table from the query. Modified helper query
  14. Edit the helper entity as follows:
  15. Add the calculated column to the column list.
  16. Remove all other columns except the columns of the Order table from the column list.
  17. Set the primary key for the helper table (in this case the O_ORDERKEY column).
  18. Use the ORDERS_CORRECTED helper entity as the source entity for the logical model to include the calculated column.