Load Source File Name in Target – Informatica

  • Updated
  • Posted in Programming
  • 2 mins read


Q) How to load the identify of the present processing flat file together with the info into the goal utilizing informatica mapping?

We will create a easy move via mapping to load the info and “file identify” from a flat file into the goal. Assume that now we have a supply file “clients” and wish to load this knowledge into the goal “customers_tgt”. The buildings of supply and goal are

Source file identify: clients.dat
Customer_Id
Location

Target: Customers_TBL
Customer_Id
Location
FileName

The steps concerned are:

  • Login to the powercenter mapping designer and go to the supply analyzer.
  • You can create the flat file or import the flat file.
  • Once you created a flat file, edit the supply and go to the properties tab. Check the choice “Add Currently Processed Flat File Name Port”. This choice is proven in the beneath picture.
  • A brand new port, “CurrentlyProcessedFileName” is created in the ports tab.
  • Now go to the Target Designer or Warehouse Designer and create or import the goal definition. Create a “Filename” port in the goal.
  • Go to the Mapping designer tab and create new mapping.
  • Drag the supply and goal into the mapping. Connect the suitable ports of supply qualifier transformation to the goal.
  • Now create a workflow and session. Edit the session and enter the suitable values for supply and goal connections.
  • The mapping move is proven in the beneath picture

The loading of the filename works for each Direct and Indirect Source filetype. After operating the workflow, the info and the filename can be loaded in to the goal. The vital level to notice is the entire path of the file can be loaded into the goal. This implies that the listing path and the filename can be loaded(instance: /informatica/9.1/SrcFiles/Customers.dat).

If you don’t need the listing path and simply need the filename to be loaded in to the goal, then comply with the beneath steps:

  • Create an expression transformation and drag the ports of supply qualifier transformation into it.
  • Edit the expression transformation, go to the ports tab, create an output port and assign the beneath expression to it.
REVERSE
(
SUBSTR
(
REVERSE(CurrentlyProcessedFileName),
1,
INSTR(REVERSE(CurrentlyProcessedFileName), '/') - 1
)
)
  • Now join the suitable ports of expression transformation to the goal definition.

Leave a Reply