Data Cleansing

Seven Stars

Data Cleansing

Hi,

Apologies if it sounds a stupid question. I need to do data cleaning as below

Original DataTransformed Data expected
MAY 1000394MAY1000394(remove spaces and convert to UpperCase)
MAY 73-4506MAY73-4506(remove spaces and convert to UpperCase)
MAY v 1915MAYV1915(remove spaces and convert to UpperCase)
MAY-P8181MAYP8181(and convert to UpperCase, also remove '-' after MAY)

 

please help out with a solution

 

Regards,

Meena


Accepted Solutions
Six Stars

Re: Data Cleansing

Here is the solution in a tMAP

Capture.PNG

Here is the code: in.originalData.trim().replace(" ","").replace("MAY-","MAY").toUpperCase()

Is that what you need?

 

EDIT: better do this in this way : in.originalData.trim().replace(" ","").toUpperCase().replace("MAY-","MAY")


All Replies
Nine Stars

Re: Data Cleansing

@muralam - is this the complete data set or these are few samples. The reason to know if the data & the "-" are in fixed positions, or variable.

Six Stars

Re: Data Cleansing

Here is the solution in a tMAP

Capture.PNG

Here is the code: in.originalData.trim().replace(" ","").replace("MAY-","MAY").toUpperCase()

Is that what you need?

 

EDIT: better do this in this way : in.originalData.trim().replace(" ","").toUpperCase().replace("MAY-","MAY")

Seven Stars

Re: Data Cleansing

Thanks for your prompt response, its working

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download