Informatica Powercenter: How to get current variable value during session run using SetVariable()

During a project I was working on I needed to have a central variable in a mapping that I could set and also retrieve during the session run. There are 4 functions that manipulate mapping variables.

When you create a mapping variable you have to choose an aggregation function for this variable, you can choose MIN,MAX and COUNT.

  • When Choosing MIN the minimal value assigned during the session run will be returned at the end of the mapping and stored in the repository.
  • The MAX option will store the MAX value that has passed through the variable during the session run.
  • The COUNT option is used to create a count variable that can be incremented by the SetCountVariable() function.

I knew I could create a variable in the mapping and set it to the value I want with the SetVariable() function. The problem is to get the current value of this variable during your sessions run.

If you want to retrieve the current value of the mapping variable you cannot just simply refer to it as $$variable_name, this will return the initial value. If you want to get the current value of a mapping variable during your session run you need to pass the SetVariable() function the following parameters :

  • SetVariable($$variable_name,NULL)

This will return the current value in stead of the initial value.

Please keep in mind that if you want to reset your variable to the initial value on every session run you need to assign the initial value in a presession variable assignment.

 

Leave a Reply

Your email address will not be published.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close