In our requirement, we used to get multiple files.
So, we used a simple jython script to read the file names and insert it into a temporary table.
There are other ways to read a file name: using a variable. This link isn't working now (Web Site Unavailable)
Once you have the file name in a variable or in a db table, then write a code to pick the date part from the file name. If this is same for all files, then you can use a common code.
If it is not common, then you can use a metadata table to store the position of date and the date format for each file type (or source stream) and then use substr and to_date to get the data in date format (I assumed you are using Oracle).
Thanks for your response.
I am very new to ODI, for one of our POC we have this requirement.
Is it possible to share a piece of jython script to read the file names
I looked up on net, and I find this blog to be very close to what I was trying to explain: Something More....: ODI Series - Pulling file names and timestamp from directory
Hope this helps
Regrets for the delay in response as I have been working on the other parts of the integration.
Finally I am able to write a simple script to get the content of the file.
from java.io import File
for x in f.list():
if x[10:14] in "RPT2":
Output when I executed above code in jython interpreter: 201408
I have created a procedure, On the command on target I have pasted the above code.
Now I have to get the value of x[15:21] ie.. 201408 from procedure and has to give it to the target column of the interface.
How could I map the procedure with interface without package as its a once time process.
Please assist me.
Instead of using print command, you may use sql along with jython to insert the file name (or the date part) into a temp table and then read it into a variable.
or you can use this approach to load the file names into a file and then read the file: http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory/
It worked. I am able to insert into db and put it in variable and able to insert into target table.