Five Stars Moe
Five Stars

How to do this

I have a column that has either 1 ID or a combination of of 2 or more IDs separated by empty spaces or dash or (dash and space) or any symbol , example below

8546

2549-98521

1235 - 1245- 4799/56478 - 241336

1225 / 25698

3698775

etc....

 

I want to separate the IDs in a way to have each ID on a separate row...

 

Thanks

 

8 REPLIES
Moderator

Re: How to do this

Hi,

Here is a component tNormalize which normalizes the input flow following SQL standard.

https://help.talend.com/display/TalendComponentsReferenceGuide63EN/tNormalize

Let us know if it is OK with you.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars Moe
Five Stars

Re: How to do this

Great mate, it worked but I still got one question:

How do I add more separators in case I have different separators in my rows as described above in my original question?

Moderator

Re: How to do this

Hi,

Could you please show us your expected result here?

 

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Twelve Stars TRF
Twelve Stars

Re: How to do this

Hi,

Use replaceAll to remove/replace undesired separators before to go with tNormalize:

Capture.PNG

Regards,

 


TRF
Five Stars Moe
Five Stars

Re: How to do this

Thank you TRF, I will try it in case the tnormalize did not work for multiple special characters (separators). 

 
Five Stars Moe
Five Stars

Re: How to do this

example:

45896-151315=988778

231154/54564

54564-4544

121212

 

Result:

45896

151315

988778

231154

54564

54564

4544

121212

 

NOTE: the separator is not known to me as it might be any special character or a combination of (space and special character).

Six Stars

Re: How to do this

Hi Moe,

You can achive this by using tJavaRow and tNormalizer.

SRC-->tJavaRow-->TNormalizer-->tLogRow

 

MultiDelimiter.PNG

 

Code in tJavaRow: output_row.COL=input_row.COL.replaceAll( "[^\\d]", " " );

 

tNormalizer:

 Capture.PNG

OutPut:

[statistics] connecting to socket on port 3762
[statistics] connected
.------.
|outPut|
|=----=|
|COL |
|=----=|
|45896 |
|151315|
|988778|
|231154|
|54564 |
|54564 |
|4544 |
|121212|
'------'

[statistics] disconnected
Job job_MultiDelimiterSplit ended at 07:07 25/04/2017. [exit code=0]

 

Regards,

 

Veeranjaneyulu Boppudi
Five Stars Moe
Five Stars

Re: How to do this

Thank you vboppudi, and thank you all. It seems Im getting good results.