case when field is blank write something else display value

Have a field settlementID, I'm wanting to display when there isn't a value for that row to show pending else show the settlement id

 

something like when settlementID is blank then 'Pending' else settlementID

 

 

thank you

Best Answer

  • guitarhero23
    guitarhero23 Contributor
    Answer ✓

    How about something like

     

    (CASE
    WHEN `settlementID` IS NULL THEN IFNULL(`settlementID`,'pending')

    ELSE `settlementID`
    END
    )

     

     

    dojo help 3.JPG



    **Make sure to like any users posts that helped you and accept the ones who solved your issue.**

Answers

  • guitarhero23
    guitarhero23 Contributor
    Answer ✓

    How about something like

     

    (CASE
    WHEN `settlementID` IS NULL THEN IFNULL(`settlementID`,'pending')

    ELSE `settlementID`
    END
    )

     

     

    dojo help 3.JPG



    **Make sure to like any users posts that helped you and accept the ones who solved your issue.**
  • thank you

  • Hi guys, I have the same issue, I have a column type deciamal with some blanks values, null funtions does not work, when I try to sum the column the final result is blank. 😥

    IFNULL(P&L Contribution Margin,0)

    NULLIF(P&L Contribution Margin,0)

    case
    WHEN STRING(P&L Contribution Margin) = '' then 0 else P&L Contribution Margin
    end

    (CASE
    WHEN IS NULL THEN NULLIF(P&L Contribution Margin,0)

    ELSE P&L Contribution Margin
    END
    )
    I will appreciate any suggestions