Friday, September 10, 2010

Informatica: How to Break target in multiple files with different filenames

Requirement.

We need to provide information broken down on seperate files with diferent file names. e.g we must provide customer statistics, every customer must be in a different file. the filename must include the customer id.



Solution.
  • Open Informatica designer
  • Go to Target designer
  • Open the appropriate target (should be file)
  • Click on "F" icon in order to create the filename port. This way we can control the output filename from a mapping.

  • Next go to mapping designer.
  • we need a mapping with the following tasks: 
  • Source->Sorter -> Expression->Transaction Control->Target
  • The expression must check for any changes at the key. We achieve that by creating a variable that holds previus value for ID.
  • if the key is changed (e.g customer id) then it must pass a signal to transaction control for commit.
  • In order to create different file for every customer we must use a Transaction control prior target. Everytime a commit is issued from the TC expression a new file is being created.


  • The sorting on the key is mandatory because of the aforementioned technique.
  • Enjoy

No comments:

Post a Comment