Immediate If Or CASE Statement to Concatenate values

Posted on 2008-11-04
Last Modified: 2012-08-14
I have a table on a report in SSRS and I need to format a field in a cell;

I have Eventnames and Rooms;
In my sql query on the back end (ms sql server), I select both fields as such:
ISNULL((R.[meeting room]),'') AS meetingroom,
E.[EventName] AS eventname,
But, Im thinking I should do the logic on the report gui instead;

If the eventname is NULL, ignore it;
And If the field is not null, concatenate the eventname at the end of the meetingroom, preferably in parentheses-
Valid values for my meetingroom are:
Mtg Rm 1
Mtg Rm 2

Valid values for EventName in my database field are:  --
Plaza Summer Crafts
Farmers Market

So, an example of a valid value for the table would be: Mtg Rm 1 (Plaza Summer Crafts)
Thanks In Advance.
Question by:jtrapat1
    LVL 12

    Accepted Solution

    It's actually easier in the sql statement.

    ISNULL((R.[meeting room]),'') AS meetingroom,
    E.[EventName] AS eventname,
    ISNULL((R.[meeting room]),'')  + ISNULL(' (' + E.[EventName] + ')', '') AS fulldescription

    Author Comment

    If you are still around, I have another related question-
    I will open up a new post if I dont hear from you;
    But, Is there any way, that I could force a line break on the cell in this table?
    I would like to have this cell height increase, if need be, and if the other two columns increase, that is OK.

    LVL 12

    Expert Comment

    You have to specify a line break in the expression:
    ="First Line" & vbCrLf & "Second Line"

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Hello, In my precious Article  ( saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now