Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ODI12c parsing data file name and storing in target

Deena URApr 24 2018 — edited May 3 2018

Is there means to take an input file name (to a mapping - our input files will have a  process_id appended to end), parse out the process_id

and then take this info and use as input to a target column in the mapping?

Are there any blogs or whitepapers regarding this type of thing available?

Thank you!

This post has been answered by Mateus Santilli on Apr 25 2018
Jump to Answer

Comments

Mateus Santilli
Answer

Hi,

Take a look:

Regards,

Mateus

Marked as Answer by Deena UR · Sep 27 2020
Deena UR

Thanks very much I will look at those.

Deena UR

The variable FileName is not getting populated. I am using it as input to a mapping. Any ideas? thank you

pastedImage_1.png

pastedImage_0.png

Adrian_Popescu-Oracle

Hi,

You have to create a package and add the variable (with the status Refresh Variable) and the mapping.

The variable may be assigned a value in the package or it may have a refreshing SQL statement.

Adrian

Deena UR

I have the variable and the mapping in the package and am running the scenario. The variable

pastedImage_0.png

pastedImage_1.png

I am using https://blogs.oracle.com/dataintegration/using-parameters-in-odi:-the-dynamic-file-name-example for instrucation on how to do this.

I have verified with a mapping that I can process (in mapping) the file which lives on the ODI server. So my model is setup correctly. I updated the resource name in the model

including the project code prefacing the filename. FileName is the my variable name.

pastedImage_3.png

thank you!

Adrian_Popescu-Oracle

When you generate a scenario from the package you are asked if you want to include the variable in the scenario. So check the variable to be included in the scenario.

When you execute the scenario you are asked to provide a value for the variable: provide the file name.

Adrian

Pavan8u

In odi package you have just declared the variable, its similar to declare section in pl/sql block.

You have to pass some value to it then only variable will holds some value and the package will run successfully.

Try to use the procedure to get the file name in the package and then link odi variable to it.

You package will be something like this

1) Odi procedure to get the file names

2) Odi variable

3) Odi mapping

Regards,

Pavan

Deena UR

Thank you for your response Adrian. I did check the box to include the variable when regenerating the scenario.  I will not know the file name at run time. I have created a variable (FileName) to house a dynamic filename.

Deena

Deena UR

Pavan,

Are you saying that I need a procedure (also) to get the value of the variable?

Christopphe, in his article , https://blogs.oracle.com/dataintegration/using-parameters-in-odi:-the-dynamic-file-name-example

made no mention of needing a procedure to accomplish retrieving a dynamic filename. But, I see nothing from what I have written

to this point , that would be performing that part.

Deena

Pavan8u

Hi,

In the blog you have mentioned they are passing file name dynamically during run time, they are not retrieving the file name.

But in your case you want to read the file name during run time.

You have to write ODI procedure to read the file name.

Regards,

Pavan

Pavan8u

I have one more question,

If you don't know the file name, how are you passing in to the datastore?

Regards,

Pavan

Deena UR

I know that filename that I am prototyping with, but I will not know it when this is up and running in production.

Regards,

Deena

pastedImage_1.png

pastedImage_0.png

Pavan8u

Now you came to the point

Create a temporary table say file_name_tbl, use above blog and write file name into that temporary table.

Use variable in refresh mode and read the file name into that variable from temporary table file_name_tbl

Any way you are already using variable in datastore.

Regards,

Pavan

Deena UR

Thanks.

I am not a java developer.

I created a procedure in ODI (below). When i run the proc scenario I get the value /dw/data/dev/datain/File added to my table. I was expecting to get the name of the first file with the /dw/data/dev/datain directory.

pastedImage_0.png

Adrian_Popescu-Oracle

Hi,

Indeed, the script inserts the full path and file name. Using Oracle SQL you can extract file name. So replace last line in your script with:

INSERT INTO URDW.ODI_GETFILENAME

select substr( '<@=theFile@>' , instr('<@=theFile@>','/',-1,1) +1) from dual

I have tested and it works. Script extract all the characters from last "/" to the end of the path - which is file name.

Hope this helps,

Adrian

Deena UR

thank you

Hi,

Please let us know if the workaround I have suggested works.

Adrian

Deena UR

Adrian,

Thank you for your help. It makes sense your suggestion and I will  hold onto it for safe keeping.

I realized after speaking with our lead that I was trying to resolve an issue that in fact we will not have!  We will actually be fed the

pertinent info for the filename and will be able to put it into a variable to use when running our package.

I will hold onto your script however.. you never know what we will need to address down the road.

Regards,

Deena

1 - 18
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 31 2018
Added on Apr 24 2018
18 comments
833 views