Search code examples
reporting-servicesrdlcdynamic-rdlc-generation

RDLC Report - how to dynamically set the height of Tablix?


I made two Tablix which they are bound by one dataset.

enter image description here

Accrording Design windows, Tablix1 and tablix2 are same height.

But It's has a problem when some data of Dataset is too long. A Tablix1's height and A Tablix2's height aren't equal.

enter image description here

How to dynamically set Height depend on texts in each row? How to set Tablix1's height = tablix2's height?


Solution

  • Having two tablix with same size dynamic rows is not possible. What you could possibly do depending on your use case is to have one tablix that looks like two seperate tablix by using the designer.

    You can use SQL to create a dataset that suits your needs.

    SELECT LeftColOuter.SerialNo AS LeftSerial, LeftColOuter.Name AS LeftName, RightColOuter.SerialNo AS RightSerial, RightColOuter.Name AS RightName FROM (
        SELECT LeftCol.SerialNo, LeftCol.Name, ROW_NUMBER() OVER (ORDER BY LeftCol.SerialNo) AS RowNum FROM
        (
            SELECT SerialNo as SerialNo, Name as Name, ROW_NUMBER() OVER (ORDER BY SerialNo) as RowNum FROM Test
        ) AS LeftCol
        WHERE RowNum % 2 = 1
    ) AS LeftColOuter
    LEFT JOIN
    (
        SELECT RightCol.Name, RightCol.SerialNo, ROW_NUMBER() OVER (ORDER BY RightCol.SerialNo) AS RowNum FROM
        (
            SELECT SerialNo as SerialNo, Name as Name, ROW_NUMBER() OVER (ORDER BY SerialNo) as RowNum FROM Test
        ) AS RightCol
        WHERE RowNum % 2 = 0
    ) AS RightColOuter ON LeftColOuter.RowNum = RightColOuter.RowNum
    

    This would create the following table

    enter image description here