Sunday, May 17, 2009

Mapping Variables Stores Values in Informatica Repository

We use mapping Variales for current session run to store and manipulate expression. We will See intelligent use of mapping variables. Mapping variables are very simple to create.
In mapping designer,
Goto Mapping Menu
Select Parameters and Variables option. create date type variable $$URF_CA_FROM.
Initialized with '04/05/2009' (any valid date value for first run).

Use this variable in any transformation column.
Use function SETVARIABLE($$URF_CA_FROM,SYSDATE) to store current date.
Link it with some other transformation coulmn of same datatype(date).
Now, When we run this mapping, variable will store current session system date value and persist in repository. At Next run time, We can utilize this value in soure qualifier in where condition.
We can use any datatype of variable to store prev run value and use this value in next execution.
i.e.
If session run on 02/06/2009, $$x variable stores this value.
now, we are running session on 12/06/2009, we can retrieve value of $$x in any transformation in same mapping. We can see this variable'spersist value in workflow manager.
right click on session at workflow level. select View persistent Values option to see and reset values.
***This logic will eliminate lot of DB dependencies and make incremental logic easy.
Limitations:
  • Variable must be initialized
  • We need to link SETVARIABLE() function column to same datatype column.
  • It should executed at least once for insert/update/delete.

5 comments:

Rohit Chandra said...

Right said Anmol....
Logic is everything.. I agree with your point of view...

Luis said...

And otherwise?
Help Me.
In the first session I make a Parameter File, in the second session I use the Parameter File. When I run the workflow many times, the session don't use the new values. The log session says: "Use persisted repository value", and it use the old values. I don't need that. Ideas?

Luis said...

Uff, I found the problem.
I added the new values to the Parameter File in the same session in a "Pre-Session Command". But the session don't found the values and says: "Use persisted repository value". Obviously I think this is a problem of PowerCenter.
The solution: I eliminated the "Pre-Session Command" and I created before a Command.
Now the session log's says: "Use override value".

Anonymous said...

gooood!

Unknown said...

Hi can you please explain the solution in detail...I am facing the same issue..session log is showing "Use persisted repository value" and not "Use override value".