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).
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:
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:
Best Regards to all!