parameter & variable

Upload: deepak-rawat

Post on 29-May-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Parameter & Variable

    1/21

    PARAMETER & VARIABLEPARAMETER & VARIABLE

    By Aleem Akhtar.By Aleem Akhtar.

  • 8/8/2019 Parameter & Variable

    2/21

    What is Parameter & variableWhat is Parameter & variable

    mapping parameters and variables in a mapping,you can reuse a mapping by altering theparameter and variable values of the mapping inthe session.

    When you use a mapping parameter or variable ina mapping, first you declare the mappingparameter or variable for use in each mapplet or

    mapping. Then, you define a value for themapping parameter or variable before you run thesession.

  • 8/8/2019 Parameter & Variable

    3/21

    Mapping Parameters

    A mapping parameter represents a constantvalue that you can define before running a

    session. A mapping parameter retains thesame value throughout the entire session.

    When you use a mapping parameter, you

    declare and use the parameter in a mappingor mapplet. Then define the value of theparameter in a parameter file.

  • 8/8/2019 Parameter & Variable

    4/21

    For example, you want to use the same session toextract transaction records for each of your

    customers individually. Instead of creating a

    separate mapping for each customer account, youcan create a mapping parameter to represent asingle customer account. Then you can use the

    parameter in a source filter to extract only data for

    that customer account. Before running thesession, you enter the value of the parameter inthe parameter file.

  • 8/8/2019 Parameter & Variable

    5/21

    When you want to use the same value for a mappingparameter each time you run the session, use thesame parameter file for each session run.

    When you want to change the value of a

    mapping parameter between sessions you can either.

    a. Update the parameter file between sessions.

    b. Create a different parameter file and configure thesession to use the new file.

    c. Remove the parameter file from the session propertiesso that the session uses the configured initial value ofthe parameter in the mapping.

  • 8/8/2019 Parameter & Variable

    6/21

    Using Mapping Parameters & variables.

    You can create mapping parameters and variables in theMapping Designer or Mapplet Designer. Once created,mapping parameters and variables appear on the Variablestab of the Expression Editor. You can use them in any

    expression in the mapplet or mapping.

    When you create a reusable transformation in thetransformation Developer, you can use any mappingparameter or variable. Since a reusable transformation isnot contained within any mapplet or mapping, theDesigner validates the usage of any mapping parameter orvariable in the expressions of reusable transformation.

  • 8/8/2019 Parameter & Variable

    7/21

    You cannot use mapping parameters andvariables interchangeably between a

    mapplet and a mapping. Mappingparameters and variables declared for amapping cannot be used within a mapplet.Similarly, you cannot use a mapping

    parameter or variable declared for amapplet ina mapping.

  • 8/8/2019 Parameter & Variable

    8/21

    Mapping Parameters.

    In the Designer, you can create a mappingparameter in a mapplet or mapping. Afteryou create a parameter, it appears in the

    Expression Editor.

    Before you run a session, define the

    mapping parameter value in a parameterfile for the session. You can use anyconstant value.

  • 8/8/2019 Parameter & Variable

    9/21

    You can change the value of a mappingparameter between sessions by editing the

    parameter file or by changing theparameter file used by the session.

  • 8/8/2019 Parameter & Variable

    10/21

    To use a mapping parameter, perform thefollowing steps.

    1. Create a mapping parameter.

    2. Use the parameter.

    3. Define the parameter value.

  • 8/8/2019 Parameter & Variable

    11/21

    Step 1. Create a Mapping Parameter.

    i. In the Mapping Designer, chooseMappings-Parameters and Variables. Or tocreate parameters for a mapplet, in theMapplet Designer, choose Mapplet-parameters and Variables.

    ii. Click the Add button.

  • 8/8/2019 Parameter & Variable

    12/21

  • 8/8/2019 Parameter & Variable

    13/21

    Step 2. Use a Mapping Parameter.

    After you create a parameter, you can use itin the Expression Editor of anytransformation in a mapping or mapplet.

    You can also use it in Source Qualifiertransformations and reusabletransformations.

  • 8/8/2019 Parameter & Variable

    14/21

    shows how you can use a mapping parameterin the SQL Editor.

  • 8/8/2019 Parameter & Variable

    15/21

    shows how you can use a mapping parameterin the Expression Editor.

  • 8/8/2019 Parameter & Variable

    16/21

    Step 3. Define a Parameter Value.

    Before you run a session, define values formapping parameters in the parameter file.When you do not define a parameter value,the PowerCenter Server uses the initialvalue for the parameter. If the initial valueis not defined, the PowerCenter Server uses

    the default value for the parameterdatatype.

  • 8/8/2019 Parameter & Variable

    17/21

    Mapping Variables.

    In the Designer, you can create mappingvariables in a mapping or mapplet. Afteryou create a mapping variable, it appearsin the Expression Editor.

    Variable Values:-

    a. Start value of a mapping variable.

    b. Current value of a mapping variable.

  • 8/8/2019 Parameter & Variable

    18/21

    Mapping Variables in Mapplets.

    1. Create a Mapping Variable.

    i. In the Mapping Designer, choose

    Mappings-Parameters and Variables.

    i. Click the Add button.

  • 8/8/2019 Parameter & Variable

    19/21

  • 8/8/2019 Parameter & Variable

    20/21

    2.2. Set a Mapping Variable Value After you declare a variable, you can use it in any expression in the

    mapping or mapplet. You can also use a mapping variable in a SourceQualifier transformation or reusable transformation.

    3. Override or Clear Saved Values. After a successful session run, the PowerCenter Server saves the final

    value of each variable in the repository. When you do not want to usethat value for the next session run, you can override it in theparameter file.

  • 8/8/2019 Parameter & Variable

    21/21

    THANKS.THANKS.