Search code examples
reporting-servicesnavision

SSRS Display display table groups side by side


Because I don't find a nice solution for my issue I hope to your expertise.

In a SSRS Report I have a dataset like this:

Tracking_Print_Right_Side Tracking_Title_No Tracking_Serial_No Tracking_Lot_No
Nein 002 SN00043 CHARGE0015
Nein 002 SN00044 CHARGE0015
Nein 002 SN00045 CHARGE0015
Ja 002 SN00050 CHARGE0015
Ja 002 SN00051 CHARGE0016
Ja 002 SN00052 CHARGE0016
Nein 003 XYZ01125 CHARGE0017
Nein 003 XYZ01126 CHARGE0017
Nein 003 XYZ01127 CHARGE0017
Nein 003 XYZ01128 CHARGE0017
Ja 003 XYZ01135 CHARGE0017
Ja 003 XYZ01136 CHARGE0017
Ja 003 XYZ01137 CHARGE0017
Ja 003 XYZ01138 CHARGE0017

Expl.: Ja = True, Nein = False

As Result I will print it like this:

|     |            | False    | True     |
| 002 | CHARGE0015 | SN00043  | SN00050  |
|     |            | SN00044  |          |
|     |            | SN00045  |          |
|     | CHARGE0016 |          | SN00051  |
|     |            |          | SN00052  | 
| 003 | CHARGE0017 | XYZ01125 | XYZ01135 |
|     |            | XYZ01126 | XYZ01136 |
|     |            | XYZ01127 | XYZ01137 |
|     |            | XYZ01128 | XYZ01136 |

Row grouping on Tracking_Title_No and Tracking_Lot_No and a column grouping on Tracking_Print_Right_Side.

I can only create tables where the False and True Groups comes one after the other and not side by side.

How I should setup the tables?

The Tracking_Print_Right_Side is created by myself.

Mainly I will split the Charge group in the middle to save space in the report and use the whole width of the report.

Best regards

Bjoern


Solution

  • You can do this quite easily with a bit of work in SQL.

    Here I have replicated your data and added a new column RowN which we can then use in the report to get the desired output.

    Here's the full query

    DECLARE @t TABLE (Tracking_Print_Right_Side sysname,Tracking_Title_No sysname, Tracking_Serial_No sysname, Tracking_Lot_No sysname)
    
    INSERT INTO @t values 
    ('Nein' , '002', 'SN00043', 'CHARGE0015'),
    ('Nein' , '002', 'SN00044', 'CHARGE0015'),
    ('Nein' , '002', 'SN00045', 'CHARGE0015'),
    ('Ja' , '002', 'SN00050', 'CHARGE0015'),
    ('Ja' , '002', 'SN00051', 'CHARGE0016'),
    ('Ja' , '002', 'SN00052', 'CHARGE0016'),
    ('Nein' , '003', 'XYZ01125', 'CHARGE0017'),
    ('Nein' , '003', 'XYZ01126', 'CHARGE0017'),
    ('Nein' , '003', 'XYZ01127', 'CHARGE0017'),
    ('Nein' , '003', 'XYZ01128', 'CHARGE0017'),
    ('Ja' , '003', 'XYZ01135', 'CHARGE0017'),
    ('Ja' , '003', 'XYZ01136', 'CHARGE0017'),
    ('Ja' , '003', 'XYZ01137', 'CHARGE0017'),
    ('Ja' , '003', 'XYZ01138', 'CHARGE0017')
    
    SELECT 
        Tracking_Title_No
        , Tracking_Lot_No
        , Tracking_Print_Right_Side
        , Tracking_Serial_No
        , RowN = ROW_NUMBER() OVER(PARTITION BY Tracking_Print_Right_Side, Tracking_Lot_No, Tracking_Title_No ORDER BY Tracking_Serial_No)
    FROM @t
    

    This gives us the following results...

    enter image description here

    If we look at serial numbers SN00050 and SN00043 they both have RowN = 1

    We can now use this to group by in the report.

    Here's the report design including the row groups. NOTE I left the RowN column in for clarity but you don't need it, as long as the rowgroup is present you can remove the column.

    enter image description here

    When we run the report we get the following...

    enter image description here