Skip to Content
avatar image
Former Member

Case Statement with Isnull

Hi gurus,

I am in process of converting a forumla field from Crystal report to Universe Objects. Please help me out in converting

if {?Dept}="NONE" then "NONE GRP" else

if isnull({CLARITY_DEP.DEPARTMENT_ID}) then "Unknown Department" else

if isnull({CLARITY_DEP.DEPARTMENT_NAME}) then "No Name for Department # " + totext({CLARITY_DEP.DEPARTMENT_ID},0,"") else

{CLARITY_DEP.DEPARTMENT_NAME} + " - " + totext({CLARITY_DEP.DEPARTMENT_ID},0,"")

Thanks in Advance

Regards

R

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 30, 2010 at 06:00 PM

    Hi,

    It depends on what is your database.

    So for instance, in Oracle, you can do this:

    CASE 
    WHEN Dept = 'NONE' then 'NONE GRP'
    WHEN nvl(CLARITY_DEP.DEPARTMENT_ID, -1) = -1 then 'Unknown Department' 
    WHEN CLARITY_DEP.DEPARTMENT_NAME = '' then 'No Name for Department # ' || to_char(CLARITY_DEP.DEPARTMENT_ID) 
    ELSE CLARITY_DEP.DEPARTMENT_NAME || ' - ' || to_char(CLARITY_DEP.DEPARTMENT_ID)
    END

    I assume that the variables you are using are table columns.

    I also converted "totext" function in "to_char" function but I am not sure that it is you want to do.

    Didier

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Does the code written over an universe object..................then i dont think we can use CASE function

      some other function should be in place

      Thanks,

      Ganesh