I have a string zip column which is sometimes populated with a date MM/dd/yyyy coming from an excel spreadsheet. When this occurs I get a field length error because talend is interpreting it as a date. When this occurs I want to either null the field completely, remove the "/" character, or update it to "00000". I tried adding the following in my tmap which does not replace the "/" with a space
//StringHandling.EREPLACE(row12.Zip, "/", "")
//StringHandling.CHANGE(row12.Zip, "\\/", "")
StringHandling.EREPLACE(row12.Zip, "/", "")
I also tried adding a treplace component to my job but that also did not seem to work. How can I either null or or remove this "/" from the data?
Hi
AdrienServian
Thank you so much for your response. I used the following in my tmap, however I am still getting the field length error when inserting into the oracle table. Do I need to add a java component in addition to adding this into my tmap?
row12.Zip.matches("{2}/{2}/{4}") ? null : row12.Zip
My tFileInputExcel component has the Zip field is set to String, however in the file itself there are two records where the field is set to date:
from source file
tinputexcel
I increased the length in the oracle table to see how it is coming across, it is still coming across as a date string with a length >14 causing the error
So for you in the tMap, if you choose the replace
row12.Zip.replaceAll("/","");
If you want to replace it by null or "00000", I would use the matches method like that
Hi
AdrienServian
Thank you so much for your response. I used the following in my tmap, however I am still getting the field length error when inserting into the oracle table. Do I need to add a java component in addition to adding this into my tmap?
row12.Zip.matches("{2}/{2}/{4}") ? null : row12.Zip
My tFileInputExcel component has the Zip field is set to String, however in the file itself there are two records where the field is set to date:
from source file
tinputexcel
I increased the length in the oracle table to see how it is coming across, it is still coming across as a date string with a length >14 causing the error