You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi,
I am new to talend. I tried to insert the data from source to target. both my source & target are mssql. I used the tmap for mapping between source & target. In the target i need to substring the source values. so i tried the following in the tmap
column_name.substring(start poisitiion,end position).
While execution I am getting the below given error.
Exception in component tMap_1
java.lang.StringIndexOutOfBoundsException: String index out of range: 24
at java.lang.String.substring(Unknown Source)
at edw.psp_dim_0_1.PSP_DIM.tMSSqlInput_1Process(PSP_DIM.java:1015)
at edw.psp_dim_0_1.PSP_DIM.runJobInTOS(PSP_DIM.java:1463)
at edw.psp_dim_0_1.PSP_DIM.main(PSP_DIM.java:1331)
Kindly suggest. Please find the screenshot of the job design & error
Last edited by sivaa.m (2012-05-29 12:16:38)
Offline
Hi,
It seems one of the input strings isn't the supposed length of 24 positions. substring will return with an exception in this case. You could use the following syntax:
column_name.substring(start poisitiion, Math.min(end position, column_name.length()))
Hope this helps.
Regards,
Arno
Offline
Hi,
Sure, what is does is get the characters starting at "start position" (being 0 in your sample I see) and ending at either the last character of the string, or the character at position "end position" (being 24 in your sample). So for a String with length 20 only 20 character will be captured while for a string with length 30, 24 characters will be captured.
Hope this helps.
Regards,
Arno
Offline
Pages: 1