cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Mapping issue: Function 'Substring error'

Former Member
0 Likes
2,276

Hi All,

I have an incoming field of length upto 30 which needs to be split into 3 diff fields of length 10 each.

I used the function 'substring' in Mapping using the following range 0-10 and 10-20 and 20-30. It works fine if the string has all 30 characters.

If the string has only 10 characters, then the first field is poulated but for the remiaing 2 fields I get the error

Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 10] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[185120, com.sap.aii.mappingtool.tf3.rt.Context@3d1048df]

I guess the issue is because string is only 20 caharcters long.

Is there any other way I can split the string without getting this error.

Many thanks

Shirin

View Entire Topic
Former Member
0 Likes

Hi,

this is the property of substring function if the value is less then the defined value it will through an error.

if you are felxible with having value in only one part e.g. 10 char then go for UDF. just write an UDF and inside udf code you can take values based on incoming value length.

Regards,

Sarvesh