You are on page 1of 21

PARAMETER & VARIABLE

By Aleem Akhtar.
What is Parameter & variable

► mapping parameters and variables in a mapping,


you can reuse a mapping by altering the
parameter and variable values of the mapping in
the session.

► When you use a mapping parameter or variable in


a mapping, first you declare the mapping
parameter or variable for use in each mapplet or
mapping. Then, you define a value for the
mapping parameter or variable before you run the
session.
Mapping Parameters

►A mapping parameter represents a constant


value that you can define before running a
session. A mapping parameter retains the
same value throughout the entire session.

► When you use a mapping parameter, you


declare and use the parameter in a mapping
or mapplet. Then define the value of the
parameter in a parameter file.
► Forexample, you want to use the same session to
extract transaction records for each of your
customers individually. Instead of creating a
separate mapping for each customer account, you
can create a mapping parameter to represent a
single customer account. Then you can use the
parameter in a source filter to extract only data for
that customer account. Before running the
session, you enter the value of the parameter in
the parameter file.
► When you want to use the same value for a mapping
parameter each time you run the session, use the
same 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 the
session to use the new file.
c. Remove the parameter file from the session properties
so that the session uses the configured initial value of
the parameter in the mapping.
Using Mapping Parameters & variables.
► You can create mapping parameters and variables in the
Mapping Designer or Mapplet Designer. Once created,
mapping parameters and variables appear on the Variables
tab of the Expression Editor. You can use them in any
expression in the mapplet or mapping.

► When you create a reusable transformation in the


transformation Developer, you can use any mapping
parameter or variable. Since a reusable transformation is
not contained within any mapplet or mapping, the
Designer validates the usage of any mapping parameter or
variable in the expressions of reusable transformation.
► You cannot use mapping parameters and
variables interchangeably between a
mapplet and a mapping. Mapping
parameters and variables declared for a
mapping cannot be used within a mapplet.
Similarly, you cannot use a mapping
parameter or variable declared for a
mapplet ina mapping.
Mapping Parameters.

► In
the Designer, you can create a mapping
parameter in a mapplet or mapping. After
you create a parameter, it appears in the
Expression Editor.

► Before you run a session, define the


mapping parameter value in a parameter
file for the session. You can use any
constant value.
► Youcan change the value of a mapping
parameter between sessions by editing the
parameter file or by changing the
parameter file used by the session.
To use a mapping parameter, perform the
following steps.

1. Create a mapping parameter.


2. Use the parameter.
3. Define the parameter value.
Step 1. Create a Mapping Parameter.

i. In the Mapping Designer, choose


Mappings-Parameters and Variables. Or to
create parameters for a mapplet, in the
Mapplet Designer, choose Mapplet-
parameters and Variables.

ii. Click the Add button.


Step 2. Use a Mapping Parameter.

► Afteryou create a parameter, you can use it


in the Expression Editor of any
transformation in a mapping or mapplet.
You can also use it in Source Qualifier
transformations and reusable
transformations.
shows how you can use a mapping parameter
in the SQL Editor.
shows how you can use a mapping parameter
in the Expression Editor.
Step 3. Define a Parameter Value.

► Before you run a session, define values for


mapping parameters in the parameter file.
When you do not define a parameter value,
the PowerCenter Server uses the initial
value for the parameter. If the initial value
is not defined, the PowerCenter Server uses
the default value for the parameter
datatype.
Mapping Variables.

► In the Designer, you can create mapping


variables in a mapping or mapplet. After
you create a mapping variable, it appears
in the Expression Editor.

► Variable Values:-
a. Start value of a mapping variable.
b. Current value of a mapping variable.
Mapping Variables in Mapplets.

1. Create a Mapping Variable.


i. In the Mapping Designer, choose
Mappings-Parameters and Variables.

i. Click the Add button.


Set a Mapping Variable Value
2.
► 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 Source
Qualifier 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 use
that value for the next session run, you can override it in the
parameter file.
THANKS.

You might also like