parse and split String in a tMap

Seventeen Stars

parse and split String in a tMap

hi,
I've got some excel file send by partners with some fields.
One of them send us the 'Adresse' in a single field , so I have to split it , analyse it to retrieve 'Code postal' and 'name of the town' ...etc !
I "have to" do this in a tMap : so read the input row => get the different value(throws a routine ?) => redirect each of them in respective output row .....
My problem its to redirect each value (@see the mapping screenshoot) => ADHCOP and ADHVIL at minimum !
I was thinking to use a routine with a String tabs return or hashMap and then redirect different value ...
or write them in static variables and read them later
but don't find how do that !
any suggestion will be appreciate
thanks
laurent
One Star

Re: parse and split String in a tMap

Hello,
I would use the "var table" in the middle to create intermediate variables and do the splitting using several regex.
If the extraction is really complex or you need to factorise this extraction elsewhere, create then use a routine.
I would do a routine for each field i need to extract.
Seventeen Stars

Re: parse and split String in a tMap

hi morbo and thanks for your reply
parse could be "complex" because some of name town will be split into several parts like french town "Plaisance du Touch" ....
I've also to analyse if the value before (normally postal code) IS a valide 'postal code' and so on ...
It's the reason why i was thinking about a routine ( and to re-use it Smiley Happy
But in that case i couldn't return array or hashMap for redirection in just a tMap as result
So a hashMap in my routine with getter function for each 'validate' value !?
Edit : i think you're right if I make a getter function foreach values I need , and put result in a var ....
negatice point is that i've to read and analyse several time same string value ...
One Star

Re: parse and split String in a tMap

Hello,
Here is what u could do to avoid multiple reading :

Seventeen Stars

Re: parse and split String in a tMap

seems it's what i'm looking for .... Smiley Happy
gonna test it right now
thanks a lot Morbo
++
Edit : It's OK Morbo ... great !

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

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