Saturday 26 October 2013

Generating Target File Name Dynamically...

Generally we give our target file name at Session Task Properties, wherein file name is static [if its not parametrized]. Suppose you have a situation in which you have to generate your target file name, based on verifying some conditions at Mapping.

How would you do that?
Informatica Target Designer give you the facility by which you can assign the FileName to your target at mapping. This will over-ride the name which you have defined at Session Level.

 As you see in above image, when you edit the your Target at Columns tab, there is one more button at last. Tool tip of that will prompt you "Add FileName column to this table"

If you click on that, new port will appear - which is static - having name as FileName, though you can change the precision and scale value of it.

That is all, remaining task is to pass the FileName value to this port from your previous transformations.

As stated, I have created FileName of my own using below function [you can give any dam name], and connected that port to our newly created target port "FileName"

TO_CHAR(SYSTIMESTAMP(), 'SSSSS')

You are done with your mapping, just create corresponding workflow and execute it. You can create only one file name in above mentioned scenario.

Note -- Lets assume you have a situation in which you are doing in-direct loading, and for each incoming file, you want to generate corresponding target file giving / specifying target file name dynamically, then above arrangement won't work. We will see that scenario in later post.

No comments:

Post a Comment