Search code examples
.netvisual-studioreportssrs-2008rdlc

How to create seat arrangement SSRS report


I want to create unsold seat SSRS report. I have vertically align report like
Current layout

But I want following design Desired layout

Data return from stored procedure is
SP return

How to implement this design in SSRS


Solution

  • Assuming you cannot change your stored proc (if you can then you can do this work in there directly).

    DECLARE @RowWidth int = 5
    CREATE TABLE #t (GroupLabel CHAR(1), SeatLabel int)
    
    INSERT INTO #t EXEC myStoredProc
    
    SELECT 
            GroupLabel, SeatLabel
            , CEILING((SeatLabel -1) / @RowWidth)  AS SeatRow
            , (SeatLabel - 1) % @RowWidth as colGrp
        FROM #t
    

    If your stored proc produced 20 results, A 1-10 and B-10 then the results would be as follows. enter image description here

    Add a mtrix control and then group by GroupLabel and SeatRow as row groups and then add a column group on colGrp.

    The final report design looks something like this (the expression is simply GroupLabel and SeatLabel concatenated. ( =Fields!GroupLabel.Value & Fields!SeatLabel.Value)

    enter image description here

    And the final output looks like this

    enter image description here

    It's not 100% but with a bit of formatting it should be close enough.