How can I reconfigure this formula of substring OBIEE for Null columns?

Hello

I use this formula of substring to conveert my 20130201 to 02/02/2013 date field and as some of my data columns are NULL, I get a result of / / that is contained in the formula itself. How can I reconfigure this formula so cells NULL return Null and if a cell has data I should see, for example, 01/02/2013?

SUBSTRING (CAST ("CSR Order Headers". "Appointed date" AS CHAR) 5 FOR 2) ' | ' /'| " SUBSTRING (CAST ("CSR Order Headers". "Appointed date" AS CHAR) 7 FOR 2) ' | ' /'| " SUBSTRING (CAST ("CSR Order Headers". "Appointed date" AS CHAR) FROM 1 to 4) "

Thank you
John

Use the CASE statement:

Example:

CASE WHEN SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR) FROM 5 FOR 2)||'/'||SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR)
FROM 7 FOR 2)||'/'||SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR) FROM 1 FOR 4) = '//'
THEN null
ELSE
SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR) FROM 5 FOR 2)||'/'||SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR)
FROM 7 FOR 2)||'/'||SUBSTRING(CAST("CSR Order Headers"."Appointment Date" AS CHAR) FROM 1 FOR 4)
END

Appreciate if you score as good/useful.

Best regards
Kalyan Chukkapalli
http://123obi.com

Tags: Business Intelligence

Similar Questions

Maybe you are looking for