You are on page 1of 12

Ho me

Inf o rmat ica

D at a Ware Ho using

Unix- She ll Scrip t s

PL SQ L

C o nt act Us

Complete reference to Informatica

16
Sharing

Ap r 20 11

MAPPING PARAMETERS & VARIABLES


Naveen

0
Discussion Forum

Transf ormat ion

Share

Filter

Discussio n Fo rum

Expressio n
Ro uter
Mapping parameters and variables represent values in mappings and mapplets.

So rter

When we use a mapping parameter o r variable in a mapping, first we declare the

Rank

ETL Life Cycle

mapping parameter o r variable fo r use in each mapplet o r mapping. Then, we

Transactio n Co ntro l

What Is Info rmatica

define a value fo r the mapping parameter o r variable befo re we run the sessio n.

So urce Qualifier

Int roduct ion

Client Co mpo nents


Services Behind Scene

MAPPING PARAMET ERS

Sto red Pro cedure


SQL Transfo rmatio n

Try U R Hand's o n Admin-

A mapping parameter represents a co nstant value that we can define

No rmalizer

Co nso le

befo re running a sessio n.

Sequence Generato r
PDFmyURL.com

Difference Between 7.1 and

A mapping parameter retains the same value thro ugho ut the entire

8 .6

sessio n.

Info rmatica 8 .6 Installatio n

Int erview Zone

Aggregato r
Unio n

Exam ple : When we want to extract reco rds o f a particular mo nth during ETL

Jo iner

pro cess, we will create a Mapping Parameter o f data type and use it in query to

Update Strategy

co mpare it with the timestamp field in SQL o verride.

Lo o k Up

After we create a parameter, it appears in the Expressio n Edito r.


Info rmatica Real Time

We can then use the parameter in any expressio n in the mapplet o r

Interview Questio ns

mapping.

Info rmatica Experienced

We can also use parameters in a so urce qualifier filter, user-defined jo in, o r

Interview Questio ns - part1

extract o verride, and in the Expressio n Edito r o f reusable transfo rmatio ns.

Info rmatica Experienced


Interview Questio ns - part2

Subscribe t o Learn
Inf ormat ica
Like

157 people like this.

MAPPING VARIABLES

Info rmatica Experienced

Unlike mapping parameters, mapping variables are values that can change

Interview Questio ns - part3

between sessio ns.

Info rmatica Experienced

The Integratio n Service saves the latest value o f a mapping variable to the

Interview Questio ns - part4

repo sito ry at the end o f each successful sessio n.

Data Wareho using co ncept

We can o verride a saved value with the parameter file.

Based Interview Questio ns

We can also clear all saved values fo r the sessio n in the Wo rkflo w

Enter yo ur email address:

Manager.

Test ing
Unit Testing
Integratio n Testing
UAT
Info rmatica Testing
Debugger
Co nstraint Based lo ading
Target Lo ad Plan

We might use a mapping variable to perfo rm an incremental read o f the so urce.


want to evaluate the transactio ns o n a daily basis. Instead o f manually entering a

Delivered by FeedBurner

sessio n o verride to filter so urce data each time we run the sessio n, we can create
a mapping variable, $$IncludeDateTime. In the so urce qualifier, create a filter to

Perf ormanceTuning

read o nly ro ws who se transactio n date equals $$IncludeDateTime, such as:


TIMESTAMP = $$IncludeDateTime
In the mapping, use a variable functio n to set the variable value to increment o ne

Advanced
Concept s

Subscribe

Fo r example, we have a so urce table co ntaining time stamped transactio ns and we

day each time the sessio n runs. If we set the initial value o f $$IncludeDateTime to
8 /1/20 0 4, the first time the Integratio n Service runs the sessio n, it reads o nly ro ws
dated

8 /1/20 0 4.

During

the

sessio n,

the

Integratio n

Service

sets

Mapping Parameter's &

$$IncludeDateTime to 8 /2/20 0 4. It saves 8 /2/20 0 4 to the repo sito ry at the end o f

Variable

the sessio n. The next time it runs the sessio n, it reads o nly ro ws fro m August 2,

Mapplets

20 0 4.

Necessity Of
Perfo rmance-tuning
Identificatio n Of bo ttle
Necks
Optimizatio n o f Bo ttle
necks
Perfo rmance tuning o f
Lo o kup
PDFmyURL.com

Partitio ning
Wo rking with links

Lo o kup
Use d in f o llo wing t ransf o rm at io ns:

Scheduler

Expressio n

Types o f Task's- 1

Filter

Types o f Task's- 2

Ro uter

Indirect Metho d fo r Lo ading


SCD - Type 1

Update Strategy

Push Do wn Optimizatio n

Chat wit h Me
Chat wit h Me
Offline

Init ial and De f ault Value :

SCD - Type 2
SCD - Type 3
Incremental Aggregatio n
Mapping Templates
Grid Pro cessing
Wo rk Flo w Variables

When we declare a mapping parameter o r variable in a mapping o r a mapplet, we


can enter an initial value. When the Integratio n Service needs an initial value, and
we did no t declare an initial value fo r the parameter o r variable, the Integratio n

Visit or's

Service uses a default value based o n the data type o f the parameter o r variable.
Data ->Default Value
Numeric ->0
String ->Empty String
Date time ->1/1/1
Variable Value s: Start value and current value o f a mapping variable
St art Value :
The start value is the value o f the variable at the start o f the sessio n. The
Integratio n Service lo o ks fo r the start value in the fo llo wing o rder:
1. Value in parameter file
2. Value saved in the repo sito ry
3. Initial value
4. Default value
Curre nt Value :
The current value is the value o f the variable as the sessio n pro gresses. When a
sessio n starts, the current value o f a variable is the same as the start value. The
final current value fo r a variable is saved to the repo sito ry at the end o f a
successful sessio n. When a sessio n fails to co mplete, the Integratio n Service
do es no t update the value o f the variable in the repo sito ry.
PDFmyURL.com

No t e : If a variable functio n is no t used to calculate the current value o f a mapping


variable, the start value o f the variable is saved to the repo sito ry.
Variable Data type and Aggregatio n Type When we declare a mapping variable in a
mapping, we need to co nfigure the Data type and aggregatio n type fo r the variable.
The IS uses the aggregate type o f a Mapping variable to determine the final current
value o f the mapping variable.
Aggregatio n types are:
Co unt : Integer and small integer data types are valid o nly.
Max: All transfo rmatio n data types except binary data type are valid.
Min: All transfo rmatio n data types except binary data type are valid.
Variable Funct io ns
Variable functio ns determine ho w the Integratio n Service calculates the current
value o f a mapping variable in a pipeline.
Se t MaxVariable : Sets the variable to the maximum value o f a gro up o f values. It
igno res ro ws marked fo r update, delete, o r reject. Aggregatio n type set to Max.
Se t MinVariable : Sets the variable to the minimum value o f a gro up o f values. It
igno res ro ws marked fo r update, delete, o r reject. Aggregatio n type set to Min.
Se t Co unt Variable : Increments the variable value by o ne. It adds o ne to the
variable value when a ro w is marked fo r insertio n, and subtracts o ne when the ro w
is Marked fo r deletio n. It igno res ro ws marked fo r update o r reject. Aggregatio n
type set to Co unt.
Se t Variable : Sets the variable to the co nfigured value. At the end o f a sessio n, it
co mpares the final current value o f the variable to the start value o f the variable.
Based o n the aggregate type o f the variable, it saves a final value to the repo sito ry.
Cre at ing Mapping Param e t e rs and Variable s
1. Open the fo lder where we want to create parameter o r variable.
2. In the Mapping Designer, click Mappings > Parameters and Variables. -o rIn the Mapplet Designer, click Mapplet > Parameters and Variables.
3. Click the add butto n.
PDFmyURL.com

4. Enter name. Do no t remo ve $$ fro m name.


5. Select Type and Data type. Select Aggregatio n type fo r mapping variables.
6 . Give Initial Value. Click o k.
Exam ple : Use o f Mapping o f Mapping Parameters and Variables
EMP will be so urce table.
Create a target table MP_MV_EXAMPLE having co lumns: EMPNO, ENAME,
DEPTNO, TOTAL_SAL, MAX_VAR, MIN_VAR, COUNT_VAR and SET_VAR.
TOTAL_SAL = SAL+ COMM + $$BONUS (Bo nus is mapping parameter that
changes every mo nth)
SET_VAR: We will be added o ne mo nth to the HIREDATE o f every
emplo yee.
Create sho rtcuts as necessary.
Cre at ing Mapping
1. Open fo lder where we want to create the mapping.
2. Click To o ls -> Mapping Designer.
3. Click Mapping-> Create-> Give name. Ex: m_mp_mv_example
4. Drag EMP and target table.
5. Transfo rmatio n -> Create -> Select Expressio n fo r list -> Create > Do ne.
6 . Drag EMPNO, ENAME, HIREDATE, SAL, COMM and DEPTNO to
Expressio n.
7. Create Parameter $$Bo nus and Give initial value as 20 0 .
8 . Create variable $$var_max o f MAX aggregatio n type and initial value 150 0 .
9 . Create variable $$var_min o f MIN aggregatio n type and initial value 150 0 .
10 . Create variable $$var_co unt o f COUNT aggregatio n type and initial value 0 .
COUNT is visible when datatype is INT o r SMALLINT.
11. Create variable $$var_set o f MAX aggregatio n type.

PDFmyURL.com

12. Create 5 o utput po rts o ut_ TOTAL_SAL, o ut_MAX_VAR, o ut_MIN_VAR,


o ut_COUNT_VAR and o ut_SET_VAR.
13. Open expressio n edito r fo r TOTAL_SAL. Do the same as we did earlier fo r
SAL+ COMM. To add $$BONUS to it, select variable tab and select the parameter
fro m mapping parameter. SAL + COMM + $$Bo nus
14. Open Expressio n edito r fo r o ut_max_var.
15. Select the variable functio n SETMAXVARIABLE fro m left side pane. Select
$$var_max

fro m

variable

tab

and

SAL

fro m

po rts

tab

as

sho wn

belo w.SETMAXVARIABLE($$var_max,SAL)

PDFmyURL.com

17. Open Expressio n edito r fo r o ut_min_var and write the fo llo wing expressio n:
SETMINVARIABLE($$var_min,SAL). Validate the expressio n.
18 . Open Expressio n edito r fo r o ut_co unt_var and write the fo llo wing expressio n:
SETCOUNTVARIABLE($$var_co unt). Validate the expressio n.
19 . Open Expressio n edito r fo r o ut_set_var and write the fo llo wing expressio n:
SETVARIABLE($$var_set,ADD_TO_DATE(HIREDATE,'MM',1)). Validate.
20 . Click OK. Expressio n Transfo rmatio n belo w:

PDFmyURL.com

21. Link all po rts fro m expressio n to target and Validate Mapping and Save it.
22. See mapping picture o n next page.

PDFmyURL.com

PARAMET ER FILE
A parameter file is a list o f parameters and asso ciated values fo r a
wo rkflo w, wo rklet, o r sessio n.
Parameter files pro vide flexibility to change these variables each time we
run a wo rkflo w o r sessio n.
We can create multiple parameter files and change the file we use fo r a
sessio n o r wo rkflo w. We can create a parameter file using a text edito r
such as Wo rdPad o r No tepad.
Enter the parameter file name and directo ry in the wo rkflo w o r sessio n
pro perties.
A parameter file co ntains the fo llo wing types o f parameters and variables:
Wo rkf lo w variable : References values and reco rds info rmatio n in a
wo rkflo w.
Wo rkle t variable : References values and reco rds info rmatio n in a wo rklet.
Use predefined wo rklet variables in a parent wo rkflo w, but we canno t use
wo rkflo w variables fro m the parent wo rkflo w in a wo rklet.
Se ssio n param e t e r: Defines a value that can change fro m sessio n to
sessio n, such as a database co nnectio n o r file name.
Mapping parameter and Mapping variable
USING A PARAMET ER FILE
Parameter files co ntain several sectio ns preceded by a heading. The heading
identifies the Integratio n Service, Integratio n Service pro cess, wo rkflo w, wo rklet, o r
sessio n to which we want to assign parameters o r variables.
Make sessio n and wo rkflo w.
Give co nnectio n info rmatio n fo r so urce and target table.
Run wo rkflo w and see result.

PDFmyURL.com

Sam ple Param e t e r File f o r Our e xam ple :


Share

In the parameter file, fo lder and sessio n names are case sensitive.
Create a text file in no tepad with name Para_File.txt

Twe e t

[Practice.ST:s_m_MP_MV_Example]
$$Bo nus=10 0 0

Sub mit

$$var_max=50 0
$$var_min=120 0
$$var_co unt=0
CONFIGURING PARAMT ER FILE

PDFmyURL.com

CONFIGURING PARAMT ER FILE


We can specify the parameter file name and directo ry in the wo rkflo w o r sessio n
pro perties.

G e t th i s

To enter a parameter file in the wo rkflo w pro perties:


1. Open a Wo rkflo w in the Wo rkflo w Manager.
2. Click Wo rkflo ws > Edit.
3. Click the Pro perties tab.
4. Enter the parameter directo ry and name in the Parameter Filename field.
5. Click OK.
To enter a parameter file in the sessio n pro perties:
1. Open a sessio n in the Wo rkflo w Manager.
2. Click the Pro perties tab and o pen the General Optio ns settings.
3. Enter the parameter directo ry and name in the Parameter Filename field.
4. Example: D:\Files\Para_File.txt o r $PMSo urceFileDir\Para_File.txt
5. Click OK.
Reactio ns:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave
a response.

0 Responses
Le ave a R e p ly

PDFmyURL.com

Enter your comment...

Comment as:
Publish

Preview

Links to this post


Create a Link

Previous Entries

Next Entries

Recent Comments
2009 - Complete reference to Informatica is proudly brought to you by Naveen

PDFmyURL.com