Query regarding how to use ISNULL in ssrs

  • Smash125

    Hall of Fame

    Points: 3527

    I want to display results based on case statement or ISNULL or coalesce

    my query looks something like this

    CASE WHEN MiddleName IS NULL THEN FirstName + ' ' + LastName ELSE FirstName + ' ' + MiddleName + ' ' + LastName 

    END AS FullName

    This can be done using ISNULL also  ISNULL(FirstName + ' ' + LastName,FirstName + ' ' + MiddleName + ' ' + LastName)

    We can achive this using coalesce

    how can achieve this in SSRS using expression. PLease guide me

  • Sue_H

    SSC Guru

    Points: 89905

    Smash125 - Sunday, February 10, 2019 4:30 AM

    I want to display results based on case statement or ISNULL or coalesce

    my query looks something like this

    CASE WHEN MiddleName IS NULL THEN FirstName + ' ' + LastName ELSE FirstName + ' ' + MiddleName + ' ' + LastName 

    END AS FullName

    This can be done using ISNULL also  ISNULL(FirstName + ' ' + LastName,FirstName + ' ' + MiddleName + ' ' + LastName)

    We can achive this using coalesce

    how can achieve this in SSRS using expression. PLease guide me

    You can check for null with IsNothing so an expression along the lines of this would display the full name:
    =IIF(IsNothing(Fields!MiddleName.Value), Fields!FirstName.Value + " " + Fields!LastName.Value,
    Fields!FirstName.Value + " " + Fields!MiddleName.Value + " " + Fields!LastName.Value)

    Sue

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply