Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Removing everything after a specified character

I am new to Talend and fairly new to anything JAVA/scripting related so would really appreciate your help.
I have a range of telephone numbers which I would like to clean up using the tMap component.
I have successfully managed to remove spaces etc, however in this field, my company has stored a lot of telephone extensions so typically the number would look like this: 
092081146x713
I would like to remove everything after the 'x' and then store the value after the 'x' in a variable and then populate the another column with the data after the 'x' so that the telephone extension is not lost when we migrate our systems next year.
Please help 0683p000009MACn.png
Caz

Labels (2)
1 Solution

Accepted Solutions
avinashbasetty
Contributor III
Contributor III

Hi Caz,

You could try this,It works

For the phone number- row1.phone.split("x") [0] 
For the phone extension- row1.phone.split("x") [1] 




Thanks,
Regards,
Avinash

View solution in original post

4 Replies
Anonymous
Not applicable
Author

use tMap and str.substring(str.lastIndexOf("x") + 1) ?
0683p000009MGmW.png
avinashbasetty
Contributor III
Contributor III

Hi Caz,

You could try this,It works

For the phone number- row1.phone.split("x") [0] 
For the phone extension- row1.phone.split("x") [1] 




Thanks,
Regards,
Avinash
Anonymous
Not applicable
Author

Thanks guys...will test this in about an hour 0683p000009MACn.png
will let you know how it goes...
Anonymous
Not applicable
Author

Thanks j1122, this worked like a charm 0683p000009MACn.png