Problem with the StringHandling in a Tmap

Five Stars

Problem with the StringHandling in a Tmap

Hello,

I have a little problem with your component "Tmap", I can not make "StringHandling.SUBSTR ()".

Here is my mistake when I do an execution.
Erreur_StringHandling.PNG

 

Job schema:

Job_StringHandling.PNG

 

The inside of my Tmap:

Tmap_StringHandling.PNG

 

Inside my file (In component: "tFileInputDelimited_1"):

Interieur_fichier_test.PNG

 

My goal at the end of my job is to have on several fields this sentence (that is to say arrived at 52 characters I pass to the next field)
I have for example the line (which I would like to divide into several fields) that is to say:

Example:
"I eat apples."

I would like to have on several fields this sentence (that is to say arrived at 52 characters I pass to the other following field)

Example:

FIELD_1|FIELD_2|FIELD_3
I eat       |apples.  |


I'm a little stuck because I use Talend methods, I can not do it.
Could you help me ?

 

PS: Sorry for my English, I do not have the top level.

Guigui8637


Accepted Solutions
Highlighted
Seven Stars

Re: Problem with the StringHandling in a Tmap

Hello,

 

   Could you please try the attached details?

 

Capture1.JPG
Capture2.JPG

 

 

 

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Manish
Eleven Stars

Re: Problem with the StringHandling in a Tmap

Si vous voulez diviser la column en taille 52 , 

 

(StringHandling.LEN(row1.command_commantier) > 0  ) ? row1.command_commantier.split("(?<=\\G.{52})")[0]  : null

(StringHandling.LEN(row1.command_commantier) > 52 ) ? row1.command_commantier.split("(?<=\\G.{52})")[1]  : null

(StringHandling.LEN(row1.command_commantier) > 104 ) ? row1.command_commantier.split("(?<=\\G.{52})")[2] : null

 

 

 

 

Regards
Abhishek KUMAR

All Replies
Eleven Stars

Re: Problem with the StringHandling in a Tmap

Bonjour ,

 

il n'y a pas method SUBSTR dans routine StringHandling.

 

Au lieu de , Vous pouvez utilise  row1.command_commantier.SUBSTR( .....)

Regards
Abhishek KUMAR
Six Stars

Re: Problem with the StringHandling in a Tmap

If you want to get a particular range, you can go with substring. I am not sure in your case you would like to separate each word individually. To do so, split() method would help you

Ex:

 

"I  am a talend developer"

 

Using substring():

row1.substring(8,14) --> O/P - talend

 

using split():

"I am a talend developer"

row1.split(" ")[0]- I

row1.split(" ")[1] -am 

row1.split(" ")[2] - a

 

Five Stars

Re: Problem with the StringHandling in a Tmap

akumar2301,

On the website of Talend help I find this: https://help.talend.com/reader/LyOlwG8xLneDXywyqpc_EA/DhyRyXxfRE5KF4Mw9BmnNQ

And your method does not work.

 

Thank you in advance.

Guigui8637

 

Five Stars

Re: Problem with the StringHandling in a Tmap

Hello avinashbasetty,

 

I used the method: row6.commande_commentaire.substring (53,104)

This is not a long length (This product is not a long length)

 

Here is the error he sends me:

Erreur_substring.PNG


Thank you in advance for your answers and help.
Regards,

 

Guigui8637

Highlighted
Seven Stars

Re: Problem with the StringHandling in a Tmap

Hello,

 

   Could you please try the attached details?

 

Capture1.JPG
Capture2.JPG

 

 

 

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Manish
Eleven Stars

Re: Problem with the StringHandling in a Tmap

Si vous voulez diviser la column en taille 52 , 

 

(StringHandling.LEN(row1.command_commantier) > 0  ) ? row1.command_commantier.split("(?<=\\G.{52})")[0]  : null

(StringHandling.LEN(row1.command_commantier) > 52 ) ? row1.command_commantier.split("(?<=\\G.{52})")[1]  : null

(StringHandling.LEN(row1.command_commantier) > 104 ) ? row1.command_commantier.split("(?<=\\G.{52})")[2] : null

 

 

 

 

Regards
Abhishek KUMAR

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download