#1 2008-12-11 13:55:56

dhonore
Member
Registered: 2008-12-08
Posts: 71

DECODE function

Hello,

I would like to implement a decode function.

e.g.

            DECODE (al1.dcf_status,
                    'PART RECEIVED', 'RECEIVED',
                    al1.dcf_status
                   )

when I define an expression like:

row1.DCF_STATUS =="PART RECEIVED"?"RECEIVED":row1.DCF_STATUS

it does not work.

Why?
Any ideas??

Thanks

Didier

Offline

#2 2008-12-12 03:18:32

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

Re: DECODE function

Hello

row1.DCF_STATUS =="PART RECEIVED"?"RECEIVED":row1.DCF_STATUS

If the filed type is a String, change to the following expression:
row1.DCF_STATUS.equals("PART RECEIVED")?"RECEIVED":row1.DCF_STATUS

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 2008-12-12 13:19:26

dhonore
Member
Registered: 2008-12-08
Posts: 71

Re: DECODE function

Is this syntax correct for 3 values:

row1.DCF_STATUS.equals("VERIFIED")?1:(row1.DCF_STATUS.equals("CLOSED")?1:(row1.DCF_STATUS.equals("RECEIVED")?1:0)) 

thanks

Didier

Offline

#4 2008-12-16 04:24:35

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

Re: DECODE function

Hello

Is this syntax correct for 3 values:

Yes, you can smile

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

Board footer

Powered by FluxBB