Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using a tMap component with an expression to split a string with the following syntax:
row1.xxxx == null ? null : row1.xxxx.substring(0, (row1.xxxx.indexOf(" ")-1))
However, when I run the job I get error: "tMap_2 String index out of range: -2".
Can someone please advise?
Thanks!
Hi,
This expression solved the problem:
(row17.xxxx == null || StringHandling.LEN(row17.xxxx) == 0) ? null : row17.xxxx.substring(0, (row17.xxxxL.indexOf(" ")-1))
I realized my data had string values of null characters, thus the String.Handling.LEN was needed.
Thank you for your help!
I prefer this method:
row1.xxxx == null ? null : row1.xxxx.replaceAll(" .*$", "")
@Larsi_88 ,You can the below way.
row7.newColumn == null ? null : (StringHandling.LEN(row7.newColumn)>3?(row7.newColumn.substring(0, (row7.newColumn .indexOf(" ")-1))):row7.newColumn)
Hi,
This expression solved the problem:
(row17.xxxx == null || StringHandling.LEN(row17.xxxx) == 0) ? null : row17.xxxx.substring(0, (row17.xxxxL.indexOf(" ")-1))
I realized my data had string values of null characters, thus the String.Handling.LEN was needed.
Thank you for your help!
Hi,
My job failed again. Does the exrepssion:
row1.xxxx == null ? null : row1.xxxx.replaceAll(" .*$", "")
replace my solution completely?