Sei sulla pagina 1di 16

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. or e!ample" if you have several fact tables that re#uire a series of dimension $eys" you can create a mapplet containing a series of %oo$up transformations to find each dimension $ey. You can then use the mapplet in each fact table mapping" rather than recreate the same loo$up logic in each mapping. &o 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. 'hen you use a mapplet in a mapping" you use an instance of the mapplet. %i$e a reusable transformation" any changes made to the mapplet are automatically inherited by all instances of the mapplet. 'hen the server runs a session using a mapplet" it e!pands the mapplet. &he 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 fle!ibility to simplify your mappings. Mapplets can( Include source definitions. A mapplet can contain source definitions and a source #ualifier 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. %i$e a reusable transformation" a mapplet can have input and output ports that are not used in a mapping. &his 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. )eusable 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. +ach mapplet must include the following( One Input transformation, Source Qualifier, or E P Source Qualifier transformation. If you include a ,ource -ualifier or +). ,ource -ualifier" you must include at least one source definition to the mapplet. At least one Output transformation. %ist of Mapplet /bjects epositor! O"#ect Advance +!ternal .rocedure transformation Aggregator transformation +). ,ource -ualifier transformation +!pression transformation +!ternal .rocedure transformation ilter transformation Input transformation %oo$up transformation $um"er per Mapplet 0nlimited Comments

0nlimited You can use one +). ,ource -ualifier" if the mapplet does not contain an Input or ,ource -ualifier transformation.

1 to 2

0nlimited 0nlimited 0nlimited You can use one Input transformation" if the mapplet does not contain a ,ource -ualifier or +). ,ource -ualifier transformation. You can use connected and unconnected %oo$up transformations. Do not use .owerMart 3.4*style %//50. functions in a mapplet.

1 to 2

0nlimited

/utput transformation )an$ transformation )eusable transformations

0nlimited 0se at least one /utput transformation per mapplet. Minimum( 2 0nlimited 0nlimited You can use reusable transformations for transformations permitted in a mapplet. 0se reusable ,e#uence 6enerators only. You can use flat file" relational" and +). 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 #ualifier. You cannot use C/7/%" M-" or 8M% source definitions. You can use one ,ource -ualifier" if the mapplet does not contain an Input or +). ,ource -ualifier transformation. You can use shortcuts to transformations permitted in a mapplet. Do not use pre* or post*session stored procedures.

,e#uence 6enerator 0nlimited transformation

,ource Definition

0nlimited

,ource -ualifier transformation ,hortcuts ,tored .rocedure transformation 0pdate ,trategy transformation

1 to 2

0nlimited 0nlimited 0nlimited

Overriding %ransformation Properties: %i$e transformations in mappings" when you configure a session using a mapplet" you can override transformation properties for transformations in a mapplet. &nsupported epositor! O"#ects: &he Designer does not support the following objects in a mapplet( C/7/% source definitions 9oiner transformations :ormalizer transformations :on*reusable ,e#uence 6enerator transformations .re* or post*session stored procedures &arget definitions .owerMart 3.4*style %//50. functions 8M% source definitions I7M M- source definitions

Mapplet Input: Data passing through a mapplet comes from a source. ,ource data for a mapplet can originate from one of two places( Sources wit'in t'e mapplet. Mapplet input can originate from within the mapplet if you include one or more source definitions in the mapplet. 'hen you use more than one source definition in a mapplet" you must connect the sources to a single ,ource -ualifier or +). ,ource -ualifier transformation. 'hen you use the mapplet in a mapping" the mapplet provides source data for the mapping. Sources outside t'e mapplet. Mapplet input can originate from outside a mapplet if you include an Input transformation to define mapplet input ports. 'hen you use the mapplet in a mapping" data passes through the mapplet as part of the mapping pipeline. &sing Sources Inside a Mapplet: You can use one or more source definitions in a mapplet to provide source data for the mapplet. ,ource definitions can represent either file" relational" or +). data. 'hen you include source definitions in a mapplet" you can connect them to one of the following transformations( ,ource -ualifier +). ,ource -ualifier You cannot connect sources to a :ormalizer transformation. You cannot use C/7/%" M-" or 8M% source definitions in a mapplet. 'hen you use sources in a mapplet" the resulting mapplet has no input ports. 'hen 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 t'e (efault SQ) Quer! in a Mapplet: 'hen you use a source #ualifier in a mapplet" you can configure the transformation properties as you would if it were in a mapping. ;owever" if you override the default ,-% #uery in the source #ualifier" the Designer prompts you to connect all mapplet output ports when you use the mapplet in a mapping. &sing Sources Outside t'e Mapplet: You can connect a mapplet to sources in a mapping by creating mapplet input ports. &o create mapplet input ports" you add an Input transformation to the mapplet. +ach port in the Input transformation connected to another transformation in the mapplet becomes a mapplet input port. 'hen 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 /utput transformation. You can connect an Input transformation to multiple transformations in a mapplet. ;owever" you can connect each port in the Input transformation to only one transformation in the mapplet. or e!ample" you can connect one port in an Input transformation to a %oo$up transformation and a different port to an +!pression transformation. You cannot connect the same port to both the %oo$up transformation and

the +!pression transformation. 'hen 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. ules for Mapplet Input: 0se the following rules when designing mapplet input( Include one of the following in a mapplet( o /ne or more source definitions" connected to a source #ualifier o A single Input transformation with at least one connected port 0se only file" relational" and +). sources in a mapplet. Do not use C/7/%" M-" or 8M% sources. Do not use a :ormalizer transformation in a mapplet. Connect Input transformation port to only one other transformation in the mapplet. Do not connect Input transformation ports to an /utput transformation.

Mapplet Output: &o pass data out of a mapplet" you create mapplet output ports. &o create mapplet output ports" you add /utput transformations to the mapplet. +ach port in an /utput transformation connected to another transformation in the mapplet becomes a mapplet output port. +ach mapplet must contain at least one /utput transformation" and at least one port in the /utput transformation must be connected within the mapplet. +ach /utput transformation in a mapplet represents a group of mapplet output ports" or output group. +ach output group can pass data to a single pipeline in the mapping. &o pass data from a mapplet to more than one pipeline" create an /utput transformation for each pipeline. 'hen 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. or e!ample" mapplet mplt<%oo$upAndCompare contains three /utput transformations to allow the mapplet to connect to three different pipelines in a mapping. :otice the /utput transformation /0&<0pdateChanges contains an unconnected port named %A,&<:AM+. ules for Mapplet Output: 0se the following rules when designing mapplet output( Include at least one /utput transformation in a mapplet with at least one connected port. Create an /utput transformation for each mapplet output group in the mapplet. +ach /utput transformation represents a mapplet output group" and each mapplet output group can be connected to a different pipeline in a mapping.

Step*+: Creating a Mapplet: 7efore designing the transformation logic within a mapplet" create a new mapplet. &o create a new mapplet( In the Mapplet Designer" choose Mapplets*Create Mapplet. +nter a descriptive mapplet name. &he recommended naming convention for mapplets is mpltMappletName. Clic$ /5. &he Mapping Designer creates a new mapplet in the Mapplet Designer. Choose )epository*,ave. Adding a Mapplet (escription: You can enter a description for the mapplet. You can also lin$ a mapplet to business documentation saved elsewhere. Descriptions appear on the &ransformation tab of the mapplet when used in the Mapping Designer. &o enter a mapplet description( 'ith a mapplet open" choose Mapplet*+dit. +nter a description of the mapplet. Clic$ /5 and save your changes to the repository.

Step ,. Creating Mapplet %ransformation )ogic: In the Mapplet Designer" you create" configure" and connect the transformations you need to create the mapplet transformation logic. 'hen designing the mapplet" thin$ about how you can ma$e the transformation logic fle!ible 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. .assive mapplets contain only passive transformations. Active mapplets contain at least one of the following transformations( Advanced +!ternal .rocedure Aggregator +). ,ource -ualifier ilter )an$ )outer ,ource -ualifier 0pdate ,trategy .assive mapplets contain only the following transformations( +!pression +!ternal .rocedure Input %oo$up /utput ,e#uence 6enerator ,tored .rocedure 'hen you use a mapplet in a mapping" all transformation rules apply to the mapplet depending on the mapplet type. or e!ample" as with an active transformation" you cannot concatenate data from an active mapplet with a different pipeline. %ransformation Properties: %i$e transformations in mappings" you can set the tracing level for an individual transformation in a mapplet. 'hen you do this" the Informatica ,erver 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. or details on each transformation property" see the individual transformation chapters in this boo$. You can override transformation tracing levels and other transformation properties with a session override.

Step -. Creating Mapplet Ports: 'hen you create a mapplet" use an Input transformation to define mapplet input ports if the mapplet contains no sources. 0se /utput transformations to create output ports" creating one /utput transformation for each mapplet output group. /nly ports in an Input or /utput transformation that are connected to other transformations in the mapplet become mapplet input or output ports. 0nconnected 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. &o pass the same values to two separate pipelines" connect the Input transformation to another transformation" such as an +!pression transformation" then split the pipeline. Configuring Mapplet Port Attri"utes: You can configure the following port attributes in an Input or /utput transformation. .ort name Description You configure all other port attributes by connecting the Input or /utput transformation port to another transformation in the mapplet. &he Input or /utput transformation port then inherits the following attributes from the connected port( Datatype .recision ,cale If you change a port connection" the Designer automatically updates the Input or /utput transformation port to match the attributes of the new connection. or e!ample" you have an /utput transformation port" :AM+" connected to a string port in an +!pression transformation. You then delete that connection and connect :AM+ to a decimal port. 'hen you ma$e the second connection" the :AM+ 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 %ransformations: 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. 0se /utput transformations to create groups of mapplet output ports. You can create a mapplet port in two ways( Add and name ports in t'e Input.Output transformation. You can create port names in Input and /utput transformations. You can also enter a description for each port name. &he port has no defined datatype" precision" or scale until you connect it to a transformation in the mapplet. (rag a port from anot'er transformation. You can create an input or output port by dragging a port from another transformation into the Input or /utput transformation. &he 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.

&o create mapplet ports( In Mapplet Designer" choose &ransformations*Create. If the mapplet contains no sources" select Mapplet Input to create an Input transformation. /therwise" select Mapplet /utput to create an /utput transformation. +nter a name" and clic$ Create. You cannot include more than one Input transformation in a mapplet. )epeat ,tep = to create as many /utput transformations as you need" then clic$ Done. You must use at least one /utput transformation to define output ports. Create a new /utput 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. &his creates and connects ports in one step. You can also create and connect ports separately( o Double*clic$ the Input transformation title bar" clic$ the .orts tab" and create and name ports. &hen clic$ /5. o &hen 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 /utput transformation. &his creates and connects ports in one step. You can also create and connect ports separately( o Double*clic$ the /utput transformation title bar" clic$ the .orts tab" and create and name ports and clic$ /5. o &hen connect the ports to the last transformation in the mapplet pipeline. )epeat ,tep 4 for each /utput transformation in the mapplet. +ach /utput transformation represents a mapplet output group. After connecting all necessary ports" choose )epository*,ave. Chec$ the /utput 'indow for the validation status. &he Designer displays a messages stating whether the mapplet is valid. If the mapplet is not valid" loo$ for additional messages in the /utput 'indow" correct the problem" and re*save the mapplet.

/or0ing wit' 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" e!port and import mapplets" create shortcuts to mapplets" and delete mapplets from the repository. 1alidating Mapplets: &he Designer validates a mapplet when you save it. You can also validate a mapplet using the Mapplet*>alidate menu command. 'hen you validate a mapplet" the Designer writes all relevant messages about the mapplet in the /utput 'indow. 0se details in the /utput 'indow to correct invalid mapplets. &he Designer validates the pipeline of a mapplet as it does a mapping" chec$ing for errors such as invalid e!pressions or missing transformation input. &he Designer also performs additional chec$s specific to mapplets. It mar$s a mapplet valid only when all of the following are true( &he mapplet contains e!actly one of the following( o Input transformation with at least one port connected to a transformation in the mapplet. o ,ource -ualifier transformation with at least one port connected to a source definition. o +). ,ource -ualifier transformation with at least one port connected to a source definition. &he mapplet contains at least one /utput transformation with at least one port connected to a transformation in the mapplet. +ach /utput transformation has a logical source in an Input" ,ource -ualifier" or +). ,ource -ualifier transformation. &o validate a mapplet using the menu( 'ith the mapplet open" choose Mappings*>alidate. )ead the messages in the /utput 'indow. Editing Mapplets: You can edit a mapplet in the Mapplet Designer. &he Designer validates your changes when you save the mapplet. 'hen 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 ma$e the following changes to a mapplet without affecting the validity of e!isting mappings and sessions( Add input or output ports. Change port names or comments. Change Input or /utput 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 )ule 3" below.

,ome mapplet changes can invalidate mappings using the mapplet" such as deleting an output port. &o prevent the Informatica ,erver from trying to run an invalid mapping" the Designer automatically mar$s a mapping and session invalid if you ma$e certain changes. &o prevent the Designer from mar$ing e!isting 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 /utput transformation. A port is also deleted when you disconnect a port in an Input or /utput transformation from a transformation in the mapplet. Do not change the datatype" precision" or scale of a mapplet port. &he datatype" precision" and scale of a mapplet port is defined by the transformation port to which it is connected in the mapplet. &herefore" if you edit a mapplet to change the datatype" precision" or scale of a port connected to a port in an Input or /utput 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. &o edit a mapplet( In the Mapplet Designer" drag the mapplet from the :avigator into the wor$space. +dit the mapplet as necessary. &o prevent invalidating mappings and sessions using the mapplet" follow the rules above. Choose )epository*,ave. (eleting Mapplets: You can delete an instance of a mapplet from a mapping. You can also delete the mapplet from the repository. 'hen you delete a mapplet" rather than an individual instance" you delete all instances of the mapplet. &his invalidates each mapping containing an instance of the mapplet or a shortcut to the mapplet. You can delete a mapplet from the :avigator. You can also delete a mapplet when it is open in the Mapplet Designer. &o delete an instance of a mapplet from a mapping( 'ith the mapping open" select the mapplet instance and choose +dit*Delete. You can also press the Delete $ey. Clic$ /5 when the warning appears. Choose )epository*,ave. &o delete a mapplet from the repository ?from the :avigator@( ,elect the mapplet in the Designer :avigator. Choose +dit*Delete. You can also press the Delete $ey. Choose )epository*,ave. &o delete an open mapplet from the repository( 'ith the mapplet open in the Mapplet Designer" choose Mapplets*Delete.

Choose )epository*,ave.

&sing 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. ;owever" 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. %i$e 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. &his 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. or e!ample" you have a mapplet named mpltCalculate:et used in four different mappings. You then edit the mapplet in the Mapplet Designer" adding several output ports and changing the input port names. +ach instance of mpltCalculate:et inherits your changes when you save them. ,ome changes might invalidate the mappings using the mapplet. &o 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. &he connections you create must complete a logical pipeline for the Designer to validate the mapping. Connecting to Mapplet Input Ports: 'hen 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 (efault SQ) Override: 'hen a mapplet contains a source #ualifier that has an override for the default ,-% #uery" you must connect all mapplet output ports to the mapping pipeline. If the mapping does not re#uire all the output from a mapplet" connect all mapplet ports to the ne!t transformation in the mapping" then leave unnecessary ports unconnected from the rest of the mapping. Connecting to Mapplet Output 2roups: 'hen 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 tas$(

0se the mapplet in the first mapping and write data in each pipeline to separate targets. 0se the targets as sources in the second mapping to join data" then perform any additional transformation necessary.

Potrebbero piacerti anche