Pages

Thursday, March 21, 2013

How to Change target file name dynamically?

When ever you create a flat file using a PowerCenter Workflow, the name of the file will be static, which is specified in the Session 'Output Filename' property.  There can be business cases where you need to generate flat files with dynamic file name, like add Timestamp with the file name . Here in this article we will discuss how we can generate flat files with dynamically changing name.

As the first step lets create the flat file definition using Target Designer

informatica target designer

Now lets add one new column 'FileName' using the 'Add File Name Column' button which is highlighted at the top right corner as shown in the below image. Dont get confused... this column is not going to be in the target file, this is the column based on the file name is dynamically changed.

informatica target designer flat file with dynamic file name

Next step will be; create the mapping to generate the flat file as shown below.
informatica power center mapping for dynamic file name

We wont worry about any transformation in the mapping except EXP_FILE_NAME Transformation. This expression transformation is responsible for generating the target file name dynamically.

Lets look at the Expression Transformation below.

informatica power center mapping for dynamic file name

Here in this transformation, we have to create an output port 'FileName' and give the expression value as 'Customer_Master_' || TO_CHAR(SYSDATE,'YYYY-MM-DD') || '.csv'. Using this expression we are dynamically attaching the Date along with the file name. You can customize this expression as your need to change the file name.

Now from the expression transformation, map the 'FileName' port to the target table and all the remaining ports.

We are all done... Now create and run the workflow; you will see the file is generated in your Target File directory with the date as part of the file name. There is not any specific setting required at the session level.

12 comments:

  1. Do You Know How To Integrate The Data By Using Informatica ETL Tool?, Learn at

    http://www.dwbiadda.com/course/informatica-online-training/

    ReplyDelete
  2. Best Informatica Training by TOP Industry Experts in Delhi/NCR with 100% Job Oriented & Placement Record.

    Free 1st Demo Class, Fresh Batch Start from Nov-2014 Call to Book Your Seat Now : 08447037614/09910840204, info@ambrot.com

    ReplyDelete
  3. Best Informatica Training by TOP Industry Experts in Delhi/NCR with 100% Job Oriented & Placement Record.

    Free 1st Demo Class, Fresh Batch Start from Nov-2014 Call to Book Your Seat Now : 08447037614/09910840204, info@ambrot.com

    ReplyDelete

  4. It's actually a cool and useful piece of info.
    Informatica Training in Bangalore,Informatica training,Informatica Online Training.

    http://www.tekclasses.com/

    ReplyDelete
  5. Good points, all.
    Informatica Training in Bangalore,Informatica Training,Informatica Online Training.
    http://www.tekclasses.com/

    ReplyDelete
  6. Nice article. Do share your opinion on http://free-informatica-tutorials.blogspot.com/

    ReplyDelete
  7. I found one of the good resource related to Informatica at https://intellipaat.com/informatica-training/ which is useful for beginners as well as Advance learner's to learn about the various concepts of Informatica.

    ReplyDelete
  8. Thanks for sharing the information..
    http://www.informaticaonlinetraining.co/

    ReplyDelete
  9. Very useful information.

    Best Informatica Online Training in India, USA, CANADA, AUSTRALIA

    Best Informatica Online Training

    ReplyDelete
  10. thank you for information
    informatica is good afrieds

    ReplyDelete