Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
0683p000009M36P.png

 

Job schema:

0683p000009M36U.png

 

The inside of my Tmap:

0683p000009M2yM.png

 

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

0683p000009M32d.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

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello,

 

   Could you please try the attached details?

 

0683p000009M36o.jpg
0683p000009M2QL.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

View solution in original post

6 Replies
akumar2301
Specialist II
Specialist II

Bonjour ,

 

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

 

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

avinashbasetty
Contributor III
Contributor III

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

 

Anonymous
Not applicable
Author

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

 

Anonymous
Not applicable
Author

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:

0683p000009M2wB.png


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

 

Guigui8637

Anonymous
Not applicable
Author

Hello,

 

   Could you please try the attached details?

 

0683p000009M36o.jpg
0683p000009M2QL.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
akumar2301
Specialist II
Specialist II

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