Removing Special character using Jython script
Hi Guru,
This Article describes a simple method to remove a single or more special character using Jython scriptMy source flat file had this special character ( ” ).
My source file in D:/odiwork/source_files with the name SALGRADE.txt has following data
"GRADE" "LOSAL" "HISAL"
"1" "700" "1200"
"2" "1201" "1400"
"3" "1401" "2000"
"4" "2001" "3000"
"5" "3001" "9999"
And suppose if we want to remove double quotes using Jython procedure
Here is the solution
Create a new ODI procedure with the technology as Jython as shown below
Then write the following procedure
Execute the procedure
Now check the contents of new file SALGRADE_NEW.txt
GRADE LOSAL HISAL
1 700 1200
2 1201 1400
3 1401 2000
4 2001 3000
5 3001 9999
In this way you can convert any characters using jython
Thanks Guru
Ram kumar Lanke
SATURDAY, 21 MAY 2011
ODI variables and Jython scripts
Hi Guru,
It is possible to pass the file or name of the file to jython without hardcoding it into the jython procedure.
The following is an example
fsrc=open('#Myvar.txt','r')
fsrc=open('#Myvar_new.txt','r')
Make sure that you are using expression editor to write variable
Thanks Guru
Ram kumar Lanke
It is possible to pass the file or name of the file to jython without hardcoding it into the jython procedure.
The following is an example
fsrc=open('#Myvar.txt','r')
fsrc=open('#Myvar_new.txt','r')
Make sure that you are using expression editor to write variable
Thanks Guru
Ram kumar Lanke
Jython script - ODI variable
Hi Guru,
There is no direct way to assign a value to the ODI variable through a jython script.
This is performed by using JDBC connections to the appropriate database inserting/updating the table field which is used to store the value.
Note : the database table used to store the values is an application based table but not an internal repository table
The value inserted into the table may then be accessed in a package step made up of an ODI variable set up in the Refresh mode.
Thanks Guru
Ram Kumar Lanke
There is no direct way to assign a value to the ODI variable through a jython script.
This is performed by using JDBC connections to the appropriate database inserting/updating the table field which is used to store the value.
Note : the database table used to store the values is an application based table but not an internal repository table
The value inserted into the table may then be accessed in a package step made up of an ODI variable set up in the Refresh mode.
Thanks Guru
Ram Kumar Lanke
www.odiguru.com
1 comments:
Hi, Nice article on Jython in ODI
Could please let me know how to debug Jython procedure in ODI, e.g. How to write to debug log etc
Thanks
Jani
Post a Comment