Thursday, 15 November 2012

How To Generate Dynamic Target File In Informatica Based On Column Value


Scenario: Generate different flat file target based on the Location name, like separate files for Mumbai.dat, Bangalore.dat, and Delhi.dat

Source Table:
Dept name
Dept ID
Location
DWH
1
Mumbai
Java
2
Bangalore
Dot net
3
Delhi

  1. Sort the source table by the column Location using a Sorter.
  2. Create Expression transformation and create the below ports
In_Location = location
V_flag = IIF(In_Location = V_ Location, 0,1)
V_ Location = In_Location
Output_flag (output port) = V_flag
Output_file_name (output port) = location ||'.dat'
****This expression will check when Location changes (Eg.from Mumbai to Bangalore).  

3. Now we need to connect the Expression Transformation to TransactionControl transformation. Informatica Power Centre allows us to control the roll back and commit on transaction based on set of rows that passes through the TransactionControl transformation. This allows to define your transaction whether it should be committed or rollback based on the rows that pass through, such as based on the Entry Date or some other column. 

Use the following syntax for the expression:
IIF (condition, value1, value2)
IIF(Output_flag = 1, TC_COMMIT_BEFORE, TC_CONTINUE_TRANSACTION)
****This expression will write to the output file when location changes (Eg.from Mumbai to Bangalore)

4.  Connect to the Target Table
Note: We have to use special port called “Filename" port in the Target file definition.
 
Experts, please share your valuable thoughts…..

14 comments:

  1. Replies
    1. Thanks .Please keep sharing your thoughts on Informatica

      Delete
  2. first of all nice explanation

    how to send dynamic emails? after completion of successful file generation?

    I know it can be done by writing a script and calling it.. if anyone can share the script or the ways to do it, will be of great help.

    thanks

    ReplyDelete
  3. REALLY GREAT EXPLANATION....KEEP POST MORE SCENARIOES.

    ReplyDelete
  4. Thanks a lot for posting the useful information..

    ReplyDelete
  5. Really nice post...

    ReplyDelete
  6. Excellent explanation

    ReplyDelete
  7. kindly share the snapshots

    ReplyDelete
  8. Thanks for your explanation. How to generate dynamic targets based on source groups if the Target has to be a SAS dataset? Or if i have to generate target tables in Oracle dynamically? Thanks.

    ReplyDelete
  9. How can we create dynamic target files in Informatica Developer 9.6

    ReplyDelete
  10. Send dynamic mails:
    File_name=`basename $file_name`
    uuencode (file_path/file_name $File_name)|mailx -s ""

    ReplyDelete
  11. Any idea how to generate dynamic files with HDFS Flat File Targets? When I give /path/to/hdfs/$$FileName, I get $$FileName created in HDFS path.

    Thanks!

    ReplyDelete
  12. Hi, I have followed same steps as mentioned above. But my WF is failing with below erro
    ERROR: The Writer ran out of buffer pool data blocks, terminating the session
    Any idea why it is failing and how to fix it?

    ReplyDelete
  13. i need to load the dept data in to target,for each dept have separate target
    target name is dept name coming from source (sales,hr,marketing etc.) and i don't know the what are the dept name have in source
    pls solve

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...

ShareThis