[resolved] StringHandling function in tMap

One Star

[resolved] StringHandling function in tMap

Is there a way that I can use the StringHandling function from tMap in other place?
For example,
I've got this expression typed in tFileCopy, basic settings -> rename -> destination filename
StringHandling.LEFT(globalMap.get("FILE_NAME"),(StringHandling.LEN(globalMap.get("FILE_NAME"))-4))+"_"+TalendDate.getCurrentDate()+".jpg"
But it returned error sort like "LEN in StringHandling method not applicable". While the TalendDate function works here.
I used the similar string in tMap
StringHandling.LEFT(row1.FILE_NAME),(StringHandling.LEN(row1.FILE_NAME)-4))+"_"+TalendDate.getCurrentDate()+".jpg" and it works.
I wonder since I'm able to use TalendDate I could also use other functions. Could any tell me if I've got the wrong understanding or I put it in the wrong way?
Thanks!

Accepted Solutions
Seven Stars

Re: [resolved] StringHandling function in tMap

You need to preface globalMap.get with the variable type in brackets. Also, getCurrentDate returns a Date not a String. So:
StringHandling.LEFT((String)globalMap.get("FILE_NAME"),(StringHandling.LEN((String)globalMap.get("FILE_NAME"))-4))+"_"+TalendDate.getDate("yyyyMMdd")+".jpg"

All Replies
Seven Stars

Re: [resolved] StringHandling function in tMap

You need to preface globalMap.get with the variable type in brackets. Also, getCurrentDate returns a Date not a String. So:
StringHandling.LEFT((String)globalMap.get("FILE_NAME"),(StringHandling.LEN((String)globalMap.get("FILE_NAME"))-4))+"_"+TalendDate.getDate("yyyyMMdd")+".jpg"
One Star

Re: [resolved] StringHandling function in tMap

THANKS!!!