#1 2012-04-27 16:55:25

fantom
Member
Registered: 2012-04-26
Posts: 15

[resolved] working with tReplace

Tags: [database]

Hi all,
first I didn't know where to write down my question, anyways, I'm new in talend and I'm using an EXCEL file as a DB source and another one for the output (just trying the treplace before using a postgresql db output) and I'm trying to replace all what's written in a field named PRODUCT, which contains something kinda "OPGSM001OPERATION_P" (including special characters like _ or - and so on) with nothing but "GSM" but in vain, I've been using both simple and advanced mode trying something like : "[A-Za-z]*GSM*[A-Za-z]" or "[A-Za-z]([0-9]{10})*GSM*[A-Za-z]([0-9]{10}) and many other options and bunch of stuff and each time it gives a different unwanted result (just like writing GSM twice or many errors instead...) . any help please I'm kinda desperate.
thanks a lot.

Offline

#2 2012-04-28 06:21:24

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] working with tReplace

Hi

Sorry, I don't understand you well, what are your expected result? Can you give us an  example to explain your request?

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2012-04-28 23:29:19

fantom
Member
Registered: 2012-04-26
Posts: 15

Re: [resolved] working with tReplace

hi shong,
yes of course, actually in a column named PRODUCT, I want to replace the content of all rows containing "GSM" with nothing but "GSM" . for exemple: we have indeed in the column PRODUCT, in the first row there is "PSGSMPROD_01", in the third row we have "PSGSMACTIVATED_00112" and so on... so, I want in the same column and in the same rows "PSGMPOD_01" and each row containing GSM to be replaced by "GSM". I hope made my problem clear this time lol I've been trying many options but in vain. I'll be so gratful for any help
thanks a lot .
greetings

Offline

#4 2012-05-02 04:25:49

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] working with tReplace

Hi
It seems you only need a simple expression on tMap as below:
row1.PRODUCT.contains("GSM")?"GSM":row1.PRODUCT

Best regards
Shong


Uploaded Images


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#5 2012-05-02 13:10:34

fantom
Member
Registered: 2012-04-26
Posts: 15

Re: [resolved] working with tReplace

Hi
Thanks a lot shong it actually worked, and I tried row1.PRODUCT_ID.matches("([A-Za-z0-9- ]+)GSM([A-Za-z0-9_ ]+)") ? "GSM" : "CDMA" as well. but it took more to work with matches than with contains. I'm so grateful.
best regards.

Offline

#6 2012-05-02 13:33:22

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] working with tReplace

fantom wrote:

Hi
Thanks a lot shong it actually worked, and I tried row1.PRODUCT_ID.matches("([A-Za-z0-9- ]+)GSM([A-Za-z0-9_ ]+)") ? "GSM" : "CDMA" as well. but it took more to work with matches than with contains. I'm so grateful.
best regards.

Cool, wink thanks for your feedback!

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#7 2012-08-07 16:30:15

Yuvraj
Guest

Re: [resolved] working with tReplace

How will i add more values ? Like ( MOBILE, WIRELESS, GSM). Want to convert it to GSM.

treplace not worth it.

Board footer

Powered by FluxBB