ODIExperts.com

The blog for Oracle Data Integrator ( ODI )

How to refresh ODI variables from file – Part 1 – Just one value

Dear all,

Get value or values from file is a common question in ODI then, in the following lines and examples, I will try to show how simple is to achieve this!

First of all, what is the problem description?

1) A flat file with just one value that need to be upload into a ODI variable

2) The flat file can or can’t have Header name (I used the case where there is a column header).

Example:

File: my_test_file.txt

Content:

Country_number
123456789

 

OK, now to explain how this work in ODI I will use a small trick:

1) Create a datastore to the file with the following characterists:

  • Read to the file  (c:temp my_test_file.txt in my case)
  •  one column (C1 in my case) and datatype String. I know that the file has a number content but let the column as String is intentional.
  • 1 line as header

2) Import the LKM File to SQL

3) Create an interface that maps the datastore, as source, to any  target, doesn’t matter if the interface works or not, it just need to be started in the Operator. At true, we’re “hunting” some code generation… Make sure that the imported LKM (step 2) was used in the interface

4) Go to operator, open the interface execution, go to “Load Data” step, Description tab and copy all content of the superior box. You should get something like:  

Copy the selected texto to your variable

Copy the selected texto to your variable

All of this was done to get that generated code, the file JDBC. It looks a little confuse but I will explain each one of its parameters in a new post.

 5) Now all that is necessary is copy the code into a refresh variable and “Voila”! Now you can refresh your variable from a file! Just drag the variable into a package…

This is how the variable should looks like:

Now just use the generated code at your variable!

Now just use the generated code at your variable!

Best Regards to all!

Cezar Santos

19 Comments

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.