I am trying to use some of the build-in functions in the expression builder. Several functions give an error saying that the method is not defined:
An example of this is the LEFT function:
The method LEFT(String, int) is undefined for the type TalendJavaSourceViewer31
In the Expression Builder (in a tMap), I have:
LEFT(row1.FirstName,50)
Ok. Tried that, and still getting an error. The syntax is now correct in the tMap expression, but when I run the full job I get:
Exception in component tMap_1
java.lang.NullPointerException
at routines.StringHandling.LEFT(StringHandling.java:209)
The code in my tMap expression is:
StringHandling.LEFT(row1.FirstName,50)
I think you are getting "null" value for row1.FirstName. While making a call to StringHandling.LEFT, we need to ensure that row1.FirstName is not null. The following expression will evalute to null if row1.FirstName is null, else it will return the first 50 characters of row1.FirstName (or row1.FirstName itself, if length of row1.FirstName is less than 50).