Tokenize Column And Store in Another Column

Six Stars

Tokenize Column And Store in Another Column

Hey Guys,

I have an requirement that source column has valus like this " discount 29 How heard facebook" now what I want to do split value after "discount 29" and how heard should be goes to different column. But here one thing to be happen that sometimes source value does not contain "how heard facebook" .

So Im thinking I need to put condition that everytime it should check that source value has "how heard facebook" or not, if it has then it will split and store in another column if not then it will insert simply as map destination column.

Any help is much apperciated.
Tags (1)

Accepted Solutions
Employee

Re: Tokenize Column And Store in Another Column

Hi Arpita,

 

      Unfortunately the query is vague but my understanding is that you are trying to split the incoming data after "discount 29" where "discount 29" will be static and the data after that string is dynamic (may or may not exist). I assume the first part of data will be coming in the same format i.e. the length will be static.

image.png

  I got the output like above after the data split in tmap using below expressions.

 

For data1    ->       StringHandling.LEFT(row1.data,11) 

For data2    ->       StringHandling.RIGHT(row1.data,row1.data.length()-11)

 

Note:- Please handle NULL by adding additional NULL check conditions based on your need.

 

Warm Regards,

 

Nikhil Thampi

 

 


All Replies
Eleven Stars

Re: Tokenize Column And Store in Another Column

it's not clear. can you add samples. define your data source it's strings delimited columns flat file….
if you are clear the answer will be clear too.

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Employee

Re: Tokenize Column And Store in Another Column

Hi Arpita,

 

      Unfortunately the query is vague but my understanding is that you are trying to split the incoming data after "discount 29" where "discount 29" will be static and the data after that string is dynamic (may or may not exist). I assume the first part of data will be coming in the same format i.e. the length will be static.

image.png

  I got the output like above after the data split in tmap using below expressions.

 

For data1    ->       StringHandling.LEFT(row1.data,11) 

For data2    ->       StringHandling.RIGHT(row1.data,row1.data.length()-11)

 

Note:- Please handle NULL by adding additional NULL check conditions based on your need.

 

Warm Regards,

 

Nikhil Thampi