Six Stars

Formatting Issue in removing decimal points

Hi Folks,

 

I have an input file in that the variable data is like below,

3038604370221.23

 

In tMap, the mapping is like below, and for the variable ACCT_LEVEL_1 I want to transform to remove the decimal point. And keep the number as 3038604370221. But when I run the expression like below I am receiving the error as

 

'java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at routines.StringHandling.LEFT(StringHandling.java:229)'

 

Expression:

StringHandling.LEFT(row1.ACCT_LEVEL_1,StringHandling.INDEX(row1.ACCT_LEVEL_1,".")) 

 

format.PNG

Tags (1)
2 REPLIES
Seven Stars

Re: Formatting Issue in removing decimal points

Do all values of ACCT_LEVEL_1 contain a decimal point? If not you will receive this error as StringHandling.INDEX will return -1 if the value is not found.

Seven Stars

Re: Formatting Issue in removing decimal points

Hello,

 

What about something like this?Captur.JPG

 

 

 

Regards

lojdr