Reputation: 27
I am working with Oracle Data Integrator 12c and I have a number of txt files, which somebody copies into a folder "/import". ODI should notice this and call a Mapping for each file. Then each file should be saved in another folder "/export"
My mapping is working perfectly for one file. I specified this file in the model part. But how can I dynamically load each file and let the mapping also work with each file and then save it?
I hope it is clear what I want :)
Thanks in advance
Upvotes: 0
Views: 3713
Reputation: 1
As per your requirement, you would need to poll into the import folder where somebody places the file. You can choose the polling time as required in seconds.
You will need to create a package with the below flow:
ODI Utility ODIFileWait, will help you to wait till file with or without a particular pattern arrives in the given folder. Once ODI finds or notices the file, it will move to next step.
Using the OSCommand ls>>filenames.txt, get all the file names in a separate file. Now create a DB table, where the file names with there load status can be populated with a unique sequence number against each record. Read this filenames.txt and populate the DB table with the load status against each file name.
In another variable, take the minimum of the sequence number from the same DB table and on basis of the sequence number retrieve the file name from the same table.
Now process your mapping or interface but make sure While creating a source datastore (file), provide a variable name(which was used for retrieval of file name in previous step) in resource name field.
Go to step 3 until count of unprocessed file is 0.
Upvotes: 0
Reputation: 1063
I have completed a similar process to your need. It was not an exact need but steps may help you. My solution was a bit tricky, since a third party send files into a directory via FTP and there is no limitation for number of files or file name standard.
Since the job was in a former client I am not able to provide you whole step codes and screenshots but I may tell the outline. You will need an ODI package
ls >> filelist.txt
filelist.txt
into a table with a sequence number for each row.#MAX_ROW_NUM
which reads the maximum file number from table above.#MAX_ROW_NUM > 0
#FILE_NAME
variable from table where ROW_NUM = #MAX_ROW_NUM
#FILE_NAME
execute the interface (source datastore must be dynamic in model)#FILE_NAME
to /completed
directory.#MAX_ROW_NUMBER
from filelist table#MAX_ROW_NUMBER
by -1
Optional step, you can KO from step 4 to another OSCommand which deletes the filelist.txt
I hope, I could explain my process clearly, in case of further help do not hesitate to ask.
Upvotes: 1