split column fields into two column using tmap

Highlighted
One Star

split column fields into two column using tmap

Hi
I have two types of file names in column "File" with datatype String
First : A.csv.bad.currentdate
Second: A.csv.good.currentdate
I want to split these filenames into two column, Good and Bad
So from tmap output, would be like this
Good                                          Bad
A.csv.good.currentdate               A.csv.bad.currentdate
may I know how I can I set up this config in tmap ?
Highlighted
One Star

Re: split column fields into two column using tmap

Can anyone Help ?
Highlighted
Community Manager

Re: split column fields into two column using tmap

Write a small piece of Java code to cut the string, for example, 
the expression for the good string:
row1.data.substring(row1.data.lastIndexOf(":")+1)
the expression for the bad string:
row1.data.substring(row1.data.IndexOf(":")+1,row1.data.indexOf("\r\n"))
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

Re: split column fields into two column using tmap

Hey Shong
Here is my output....Please check
http://prntscr.com/9px09l

I want to split "File" Column into two columns, "Bad" and "Read".
So output would be like this
http://prntscr.com/9px2hy

May I know how can I do this in Tmap ?
Highlighted
One Star

Re: split column fields into two column using tmap

Hey Shong, Can you suggest me for the same ?
Highlighted
One Star

Re: split column fields into two column using tmap

Anyone ?
Highlighted
Community Manager

Re: split column fields into two column using tmap

Hi 
Use a tMap to generate two output tables, add a filter condition to filter the reject rows for reject table or bad rows for bad table, for example:
row1.file.contains("bad")
Add a sequence id for each table for doing join in the next subjob to merge the bad and reject columns, see

Hope it helps.
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Two Stars

Re: split column fields into two column using tmap

I have to split the val from this file to two separate files, where 1st file file contains 1,2,3 and 2nd file contains 15,25,34. 

dist        val

A

              1

              2 

              3

B

              15

              25

              34

 

how do I do this?

Can somebody help me?

 

 

Highlighted
Two Stars

Re: split column fields into two column using tmap

Hi Shong can you help me?

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog