Table of Contents

Search

  1. Preface
  2. Product Overview
  3. Before You Begin
  4. Tutorial Lesson 1
  5. Tutorial Lesson 2
  6. Tutorial Lesson 3
  7. Tutorial Lesson 4
  8. Tutorial Lesson 5
  9. Tutorial Lesson 6
  10. Naming Conventions
  11. Glossary

Getting Started

Getting Started

Creating an Expression Transformation

Creating an Expression Transformation

Now that you have calculated the highest, lowest, and average prices for items, the next step is to calculate the average profitability of items from each manufacturer.
To add this information to the target, you create an Expression transformation that takes the average price of items from a manufacturer, performs the calculation, and then passes the result along to the target. As you develop transformations, you connect transformations using the output of one transformation as an input for others.
  1. Click
    Transformation
    Create
    .
  2. Select
    Expression
    and name the transformation EXP_AvgProfit. Click
    Create
    , and then click
    Done
    .
    The naming convention for Expression transformations is EXP_
    TransformationName
    .
    The Mapping Designer adds an Expression transformation to the mapping.
    The following mapping shows an unconnected Expression transformation:
    The mapping shows the generated EXP_AvgProfit Expression transformation. It is unconnected.
    Right-click on the source definition and source qualifier and select
    Iconize
    to iconize them.
  3. Open the Expression transformation.
  4. Add an input port, IN_AVG_PRICE, using the Decimal datatype with precision of 19 and scale of 2.
  5. Add an output port, OUT_AVG_PROFIT, using the Decimal datatype with precision of 19 and scale of 2. Clear the Input port.
    OUT_AVG_PROFIT is an output port, not an input/output port. You cannot enter expressions in input/output ports.
  6. Enter the following expression for OUT_AVG_PROFIT:
    IN_AVG_PRICE * 0.2
  7. To validate the expression, click Validate.
  8. To reflect the latest changes from the expression condition in the test expression section in the right pane, click Refresh.
  9. In the right pane, enter sample values for the input ports used within the expression, and click Evaluate.
    The following image shows the sample value and the result in the right pane:
  10. Close the
    Expression Editor
    and then close the EXP_AvgProfit transformation.
  11. Connect OUT_AVG_PRICE from the Aggregator to IN_AVG_PRICE input port.
    The following mapping shows a link from the Aggregator transformation port OUT_AVG_PRICE to the input port IN_AVG_PRICE:
    The mapping now shows OUT_AVG_PRICE in the Aggregator transformation connected to the input port IN_AVG_PRICE in the EXP_AvgProfit Expression transformation.
  12. Connect the OUT_AVG_PROFIT port in the Expression Transformation to the AVG_PROFIT port in the T_ITEM_SUMMARY target definition.
  13. Click
    Repository
    Save
    .

0 COMMENTS

We’d like to hear from you!