Tuesday, 31 May 2011

Mapplets Overview:

Mapplets Overview:
A mapplet is a reusable object that represents a set of transformations. It allows you to reuse transformation logic and can contain as many transformations as you need. You create mapplets in the Mapplet Designer. Create a mapplet when you want to use a standardized set of transformation logic in several mappings. For example, if you have several fact tables that require a series of dimension keys, you can create a mapplet containing a series of Lookup transformations to find each dimension key. You can then use the mapplet in each fact table mapping, rather than recreate the same lookup logic in each mapping.

To create a mapplet, you add, connect, and configure transformations to complete the desired transformation logic. After you save a mapplet, you can use it in a mapping to represent the transformations within the mapplet. When you use a mapplet in a mapping, you use an instance of the mapplet. Like a reusable transformation, any changes made to the mapplet are automatically inherited by all instances of the mapplet. When the server runs a session using a mapplet, it expands the mapplet. The server then runs the session as it would any other session, passing data through each transformation in the mapplet as designed. Mapplets provide a wide range of flexibility to simplify your mappings. Mapplets can:
  • Include source definitions. A mapplet can contain source definitions and a source qualifier to provide source data for a mapping.
  • Accept data from sources in a mapping. A mapplet with no source definitions can accept data from a mapping through mapplet input ports.
  • Include multiple transformations. A mapplet can contain as many transformations as you need.
  • Pass data to multiple pipelines. A mapplet can contain multiple groups of output ports, or output groups. You can connect ports in each output group to a different pipeline in the mapping.
  • Contain unused ports. Like a reusable transformation, a mapplet can have input and output ports that are not used in a mapping. This allows you to design a mapplet for a range of uses.


Mapplet Components:
A mapplet can contain transformations, reusable transformations, and shortcuts to transformations. You can include as many transformations in a mapplet as you need. Although you can use reusable transformations and shortcuts in a mapplet, to protect the validity of your mapplet, use a copy of a transformation instead. Reusable transformations and shortcuts automatically inherit changes to their original transformations. If you use a reusable transformation or shortcut in a mapplet, changes to these objects can invalidate the mapplet and every mapping using the mapplet. You can create a non-reusable instance of a reusable transformation. Each mapplet must include the following:
  • One Input transformation, Source Qualifier, or ERP Source Qualifier transformation. If you include a Source Qualifier or ERP Source Qualifier, you must include at least one source definition to the mapplet.
  • At least one Output transformation.

List of Mapplet Objects
Repository Object
Number per Mapplet
Comments
Advance External Procedure transformation
Unlimited

Aggregator transformation
Unlimited

ERP Source Qualifier transformation
0 to 1
You can use one ERP Source Qualifier, if the mapplet does not contain an Input or Source Qualifier transformation.
Expression transformation
Unlimited

External Procedure transformation
Unlimited

Filter transformation
Unlimited

Input transformation
0 to 1
You can use one Input transformation, if the mapplet does not contain a Source Qualifier or ERP Source Qualifier transformation.
Lookup transformation
Unlimited
You can use connected and unconnected Lookup transformations. Do not use PowerMart 3.5-style LOOKUP functions in a mapplet.
Output transformation
Unlimited
Minimum: 1
Use at least one Output transformation per mapplet.
Rank transformation
Unlimited

Reusable transformations
Unlimited
You can use reusable transformations for transformations permitted in a mapplet.
Sequence Generator transformation
Unlimited
Use reusable Sequence Generators only.
Source Definition
Unlimited
You can use flat file, relational, and ERP source definitions if the mapplet does not contain an Input transformation. You can include multiple source definitions if you connect them to a single source qualifier. You cannot use COBOL, MQ, or XML source definitions.
Source Qualifier transformation
0 to 1
You can use one Source Qualifier, if the mapplet does not contain an Input or ERP Source Qualifier transformation.
Shortcuts
Unlimited
You can use shortcuts to transformations permitted in a mapplet.
Stored Procedure transformation
Unlimited
Do not use pre- or post-session stored procedures.
Update Strategy transformation
Unlimited


Overriding Transformation Properties:
Like transformations in mappings, when you configure a session using a mapplet, you can override transformation properties for transformations in a mapplet.

Unsupported Repository Objects:
The Designer does not support the following objects in a mapplet:
  • COBOL source definitions
  • Joiner transformations
  • Normalizer transformations
  • Non-reusable Sequence Generator transformations
  • Pre- or post-session stored procedures
  • Target definitions
  • PowerMart 3.5-style LOOKUP functions
  • XML source definitions
  • IBM MQ source definitions


Mapplet Input:
Data passing through a mapplet comes from a source. Source data for a mapplet can originate from one of two places:
  • Sources within the mapplet. Mapplet input can originate from within the mapplet if you include one or more source definitions in the mapplet. When you use more than one source definition in a mapplet, you must connect the sources to a single Source Qualifier or ERP Source Qualifier transformation. When you use the mapplet in a mapping, the mapplet provides source data for the mapping.
  • Sources outside the mapplet. Mapplet input can originate from outside a mapplet if you include an Input transformation to define mapplet input ports. When you use the mapplet in a mapping, data passes through the mapplet as part of the mapping pipeline.

Using Sources Inside a Mapplet:
You can use one or more source definitions in a mapplet to provide source data for the mapplet. Source definitions can represent either file, relational, or ERP data. When you include source definitions in a mapplet, you can connect them to one of the following transformations:
  • Source Qualifier
  • ERP Source Qualifier
You cannot connect sources to a Normalizer transformation. You cannot use COBOL, MQ, or XML source definitions in a mapplet. When you use sources in a mapplet, the resulting mapplet has no input ports. When you use the resulting mapplet in a mapping, the mapplet provides source data for the mapping and is the first object in the mapping pipeline.

Overriding the Default SQL Query in a Mapplet:
When you use a source qualifier in a mapplet, you can configure the transformation properties as you would if it were in a mapping. However, if you override the default SQL query in the source qualifier, the Designer prompts you to connect all mapplet output ports when you use the mapplet in a mapping.

Using Sources Outside the Mapplet:
You can connect a mapplet to sources in a mapping by creating mapplet input ports. To create mapplet input ports, you add an Input transformation to the mapplet. Each port in the Input transformation connected to another transformation in the mapplet becomes a mapplet input port. When you use an Input transformation in a mapplet, you must connect at least one port in the Input transformation to another transformation in the mapplet. You cannot connect ports in an Input transformation directly to an Output transformation.

You can connect an Input transformation to multiple transformations in a mapplet. However, you can connect each port in the Input transformation to only one transformation in the mapplet. For example, you can connect one port in an Input transformation to a Lookup transformation and a different port to an Expression transformation. You cannot connect the same port to both the Lookup transformation and the Expression transformation. When you use the mapplet in a mapping, the Designer displays all available input ports below the Input transformation name. You do not have to use all mapplet input ports in each mapping, but you must use at least one.

Rules for Mapplet Input:
Use the following rules when designing mapplet input:
  • Include one of the following in a mapplet:
    • One or more source definitions, connected to a source qualifier
    • A single Input transformation with at least one connected port
  • Use only file, relational, and ERP sources in a mapplet. Do not use COBOL, MQ, or XML sources.
  • Do not use a Normalizer transformation in a mapplet.
  • Connect Input transformation port to only one other transformation in the mapplet.
  • Do not connect Input transformation ports to an Output transformation.


Mapplet Output:
To pass data out of a mapplet, you create mapplet output ports. To create mapplet output ports, you add Output transformations to the mapplet. Each port in an Output transformation connected to another transformation in the mapplet becomes a mapplet output port. Each mapplet must contain at least one Output transformation, and at least one port in the Output transformation must be connected within the mapplet.

Each Output transformation in a mapplet represents a group of mapplet output ports, or output group. Each output group can pass data to a single pipeline in the mapping. To pass data from a mapplet to more than one pipeline, create an Output transformation for each pipeline. When you use a mapplet in a mapping, you connect ports in each output group to different pipelines. You do not have to use all mapplet output ports in a mapping, but you must use at least one. For example, mapplet mplt_LookupAndCompare contains three Output transformations to allow the mapplet to connect to three different pipelines in a mapping. Notice the Output transformation OUT_UpdateChanges contains an unconnected port named LAST_NAME.

Rules for Mapplet Output:
Use the following rules when designing mapplet output:
  • Include at least one Output transformation in a mapplet with at least one connected port.
  • Create an Output transformation for each mapplet output group in the mapplet. Each Output transformation represents a mapplet output group, and each mapplet output group can be connected to a different pipeline in a mapping.


Step-1: Creating a Mapplet:
Before designing the transformation logic within a mapplet, create a new mapplet. To create a new mapplet:
  • In the Mapplet Designer, choose Mapplets-Create Mapplet.
  • Enter a descriptive mapplet name. The recommended naming convention for mapplets is mpltMappletName.
  • Click OK. The Mapping Designer creates a new mapplet in the Mapplet Designer.
  • Choose Repository-Save.

Adding a Mapplet Description:
You can enter a description for the mapplet. You can also link a mapplet to business documentation saved elsewhere. Descriptions appear on the Transformation tab of the mapplet when used in the Mapping Designer. To enter a mapplet description:
  • With a mapplet open, choose Mapplet-Edit.
  • Enter a description of the mapplet.
  • Click OK and save your changes to the repository.


Step 2. Creating Mapplet Transformation Logic:
In the Mapplet Designer, you create, configure, and connect the transformations you need to create the mapplet transformation logic. When designing the mapplet, think about how you can make the transformation logic flexible enough to use in different mappings.

Active and Passive Mapplets:
A mapplet can be active or passive depending on the transformations in the mapplet. Active mapplets contain one or more active transformations. Passive mapplets contain only passive transformations. Active mapplets contain at least one of the following transformations:
  • Advanced External Procedure
  • Aggregator
  • ERP Source Qualifier
  • Filter
  • Rank
  • Router
  • Source Qualifier
  • Update Strategy

Passive mapplets contain only the following transformations:
  • Expression
  • External Procedure
  • Input
  • Lookup
  • Output
  • Sequence Generator
  • Stored Procedure
When you use a mapplet in a mapping, all transformation rules apply to the mapplet depending on the mapplet type. For example, as with an active transformation, you cannot concatenate data from an active mapplet with a different pipeline.

Transformation Properties:
Like transformations in mappings, you can set the tracing level for an individual transformation in a mapplet. When you do this, the Informatica Server provides the configured level detail in session log for every instance of the transformation in every mapping using the mapplet. You can configure all other transformation properties in a mapplet as you would in a mapping. For details on each transformation property, see the individual transformation chapters in this book. You can override transformation tracing levels and other transformation properties with a session override.


Step 3. Creating Mapplet Ports:
When you create a mapplet, use an Input transformation to define mapplet input ports if the mapplet contains no sources. Use Output transformations to create output ports, creating one Output transformation for each mapplet output group. Only ports in an Input or Output transformation that are connected to other transformations in the mapplet become mapplet input or output ports. Unconnected ports do not display when you use the mapplet in a mapping. You can connect an Input transformation to only one transformation in a mapplet. To pass the same values to two separate pipelines, connect the Input transformation to another transformation, such as an Expression transformation, then split the pipeline.

Configuring Mapplet Port Attributes:
You can configure the following port attributes in an Input or Output transformation.
  • Port name
  • Description

You configure all other port attributes by connecting the Input or Output transformation port to another transformation in the mapplet. The Input or Output transformation port then inherits the following attributes from the connected port:
  • Datatype
  • Precision
  • Scale

If you change a port connection, the Designer automatically updates the Input or Output transformation port to match the attributes of the new connection. For example, you have an Output transformation port, NAME, connected to a string port in an Expression transformation. You then delete that connection and connect NAME to a decimal port. When you make the second connection, the NAME port becomes a decimal port with the precision and scale of the connected port. You can view the datatype, precision, and scale of available mapplet ports when you use the mapplet in a mapping.

Adding Ports to Input/Output Transformations:
After creating transformation logic for a mapplet, you can create mapplet ports. If the mapplet includes no source definitions, use an Input transformation to define mapplet input ports. Use Output transformations to create groups of mapplet output ports. You can create a mapplet port in two ways:
  • Add and name ports in the Input/Output transformation. You can create port names in Input and Output transformations. You can also enter a description for each port name. The port has no defined datatype, precision, or scale until you connect it to a transformation in the mapplet.
  • Drag a port from another transformation. You can create an input or output port by dragging a port from another transformation into the Input or Output transformation. The new port inherits the port name, description, datatype, and scale of the original port. You can edit the new port name and description in the transformation.

To create mapplet ports:
  • In Mapplet Designer, choose Transformations-Create.
  • If the mapplet contains no sources, select Mapplet Input to create an Input transformation. Otherwise, select Mapplet Output to create an Output transformation. Enter a name, and click Create. You cannot include more than one Input transformation in a mapplet.
  • Repeat Step 2 to create as many Output transformations as you need, then click Done. You must use at least one Output transformation to define output ports. Create a new Output transformation for each output group in the mapplet.
  • If you create an Input transformation, drag ports from the first transformation in the mapplet pipeline to the Input transformation ports. This creates and connects ports in one step. You can also create and connect ports separately:
    • Double-click the Input transformation title bar, click the Ports tab, and create and name ports. Then click OK.
    • Then connect the ports to the first transformation in the mapplet pipeline.
  • Create all desired output ports by connecting the last transformation in the mapplet pipeline to the Output transformation. This creates and connects ports in one step. You can also create and connect ports separately:
    • Double-click the Output transformation title bar, click the Ports tab, and create and name ports and click OK.
    • Then connect the ports to the last transformation in the mapplet pipeline.
  • Repeat Step 5 for each Output transformation in the mapplet. Each Output transformation represents a mapplet output group.
  • After connecting all necessary ports, choose Repository-Save.
  • Check the Output Window for the validation status.

The Designer displays a messages stating whether the mapplet is valid. If the mapplet is not valid, look for additional messages in the Output Window, correct the problem, and re-save the mapplet.


Working with Mapplets:
After you create a mapplet, you can validate or edit the mapplet in the Mapplet Designer. You can also use the Designer to copy mapplets, export and import mapplets, create shortcuts to mapplets, and delete mapplets from the repository.

Validating Mapplets:
The Designer validates a mapplet when you save it. You can also validate a mapplet using the Mapplet-Validate menu command. When you validate a mapplet, the Designer writes all relevant messages about the mapplet in the Output Window. Use details in the Output Window to correct invalid mapplets. The Designer validates the pipeline of a mapplet as it does a mapping, checking for errors such as invalid expressions or missing transformation input. The Designer also performs additional checks specific to mapplets. It marks a mapplet valid only when all of the following are true:
  • The mapplet contains exactly one of the following:
    • Input transformation with at least one port connected to a transformation in the mapplet.
    • Source Qualifier transformation with at least one port connected to a source definition.
    • ERP Source Qualifier transformation with at least one port connected to a source definition.
  • The mapplet contains at least one Output transformation with at least one port connected to a transformation in the mapplet.
  • Each Output transformation has a logical source in an Input, Source Qualifier, or ERP Source Qualifier transformation.

To validate a mapplet using the menu:
  • With the mapplet open, choose Mappings-Validate.
  • Read the messages in the Output Window.

Editing Mapplets:
You can edit a mapplet in the Mapplet Designer. The Designer validates your changes when you save the mapplet. When you save changes to a mapplet, all instances of the mapplet and all shortcuts to the mapplet inherit your changes. If you edit a mapplet after using it in mappings and creating sessions for those mappings, your changes might affect the validity of the mappings and sessions. You can make the following changes to a mapplet without affecting the validity of existing mappings and sessions:
  • Add input or output ports.
  • Change port names or comments.
  • Change Input or Output transformation names or comments.
  • Change transformation names, comments, or properties.
  • Change port default values for transformations in the mapplet.
  • Add or remove transformations in the mapplet, providing you do not change the mapplet type as described in Rule 3, below.

Some mapplet changes can invalidate mappings using the mapplet, such as deleting an output port. To prevent the Informatica Server from trying to run an invalid mapping, the Designer automatically marks a mapping and session invalid if you make certain changes. To prevent the Designer from marking existing mappings and sessions invalid, use the following rules when editing a mapplet in use:
  • Do not delete a port from the mapplet. A port is deleted from a mapplet when you manually delete a connected port from an Input or Output transformation. A port is also deleted when you disconnect a port in an Input or Output transformation from a transformation in the mapplet.
  • Do not change the datatype, precision, or scale of a mapplet port. The datatype, precision, and scale of a mapplet port is defined by the transformation port to which it is connected in the mapplet. Therefore, if you edit a mapplet to change the datatype, precision, or scale of a port connected to a port in an Input or Output transformation, you change the mapplet port itself.
  • Do not change the mapplet type. If you remove all active transformations from an active mapplet, the mapplet becomes passive. If you add an active transformation to a passive mapplet, the mapplet becomes active.

To edit a mapplet:
  • In the Mapplet Designer, drag the mapplet from the Navigator into the workspace.
  • Edit the mapplet as necessary.
  • To prevent invalidating mappings and sessions using the mapplet, follow the rules above.
  • Choose Repository-Save.

Deleting Mapplets:
You can delete an instance of a mapplet from a mapping. You can also delete the mapplet from the repository. When you delete a mapplet, rather than an individual instance, you delete all instances of the mapplet. This invalidates each mapping containing an instance of the mapplet or a shortcut to the mapplet. You can delete a mapplet from the Navigator. You can also delete a mapplet when it is open in the Mapplet Designer. To delete an instance of a mapplet from a mapping:
  • With the mapping open, select the mapplet instance and choose Edit-Delete. You can also press the Delete key.
  • Click OK when the warning appears.
  • Choose Repository-Save.

To delete a mapplet from the repository (from the Navigator):
  • Select the mapplet in the Designer Navigator.
  • Choose Edit-Delete. You can also press the Delete key.
  • Choose Repository-Save.

To delete an open mapplet from the repository:
  • With the mapplet open in the Mapplet Designer, choose Mapplets-Delete.
  • Choose Repository-Save.


Using Mapplets in Mappings:
In a mapping, a mapplet has input and output ports which can be connected to other transformations in the mapping. You do not have to connect all mapplet ports in a mapping. However, the connections you create must complete a logical flow of data for the Designer to validate the mapping.

You can use a mapplet in any mapping in the folder. You can even use the mapplet more than once in a single mapping. Like a reusable transformation, when you drag a mapplet into a mapping, the Designer creates an instance of the mapplet. You can enter comments for the instance of the mapplet in the mapping. You cannot otherwise edit the mapplet in the Mapping Designer. This protects the mapplet from being edited by the user creating the mapping. If you later edit the mapplet, each instance of the mapplet inherits your changes automatically.

For example, you have a mapplet named mpltCalculateNet used in four different mappings. You then edit the mapplet in the Mapplet Designer, adding several output ports and changing the input port names. Each instance of mpltCalculateNet inherits your changes when you save them. Some changes might invalidate the mappings using the mapplet. To use a mapplet, you perform the following steps:
  • Drag the mapplet into the mapping.
  • If a mapplet contains input ports, connect at least one mapplet input port to a transformation in the mapping.
  • Connect at least one output port to a transformation in the mapping.

The connections you create must complete a logical pipeline for the Designer to validate the mapping.

Connecting to Mapplet Input Ports:
When using a mapplet with input ports in a mapping, you connect the mapplet input ports to the mapping pipeline. You can pass data into a mapplet when it originates from a single active transformation. You cannot pass data from two or more active transformations into a mapplet.

Connecting to Mapplets Containing Default SQL Override:
When a mapplet contains a source qualifier that has an override for the default SQL query, you must connect all mapplet output ports to the mapping pipeline. If the mapping does not require all the output from a mapplet, connect all mapplet ports to the next transformation in the mapping, then leave unnecessary ports unconnected from the rest of the mapping.

Connecting to Mapplet Output Groups:
When using a mapplet in a mapping, you connect the mapplet output ports to the mapping pipeline. If a mapplet contains more than one output group, connect ports in each output group to a different pipeline in the mapping. After connecting mapplet output groups to different pipelines in the mapping, you cannot join data in the pipelines. If you need to join the pipelines, you can create two mappings to perform this task:
  • Use the mapplet in the first mapping and write data in each pipeline to separate targets.
  • Use the targets as sources in the second mapping to join data, then perform any additional transformation necessary.



1 comment:

  1. Every site, blog says do not use COBOL or Normalizer transformation in a Mapplet. But no one tells why? Can't Normalizer Transformation be turned into reusable transformation or something else? Does any one knows answer for it?

    ReplyDelete