Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Job schema:
The inside of my Tmap:
Inside my file (In component: "tFileInputDelimited_1"):
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
Hello,
Could you please try the attached details?
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 🙂
Bonjour ,
il n'y a pas method SUBSTR dans routine StringHandling.
Au lieu de , Vous pouvez utilise row1.command_commantier.SUBSTR( .....)
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
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
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:
Thank you in advance for your answers and help.
Regards,
Guigui8637
Hello,
Could you please try the attached details?
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 🙂
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