0

I make a report like these

enter image description here

This report compound with Tablix. Each row show different a chart and layout. So each row is sub report (I called subreport_all). Inside subreport_all include all patterns. ( 30 patterns , 30 subreports) enter image description here

Main report will send parameter such as Pattern No. and use this parameter for select only one for showing and hide others. By this expression.

=iif(Parameters!pPatternNo.Value="A",false,true)

For example. if subreport_all includes subreportA,B,C,D,...etc. If row is Pattern A, will show only A and hide B,C,D,...etc.

A performance of this case is great until subreport A,B,C,... must show two columns inside them.

So I must create subreport_all inside subreport_all. It make multiple loaded. enter image description here

I designed like these enter image description here

But rendering report is very slow for 3 minutes and take RAM memory more than 2GB. User cannot acceptable this performance. How to fix it. What any idea for selecting a subreport dynamically.

EDIT: Sorry Alan Schofield, I explained not clear about Two Column. Patterns include 3 layouts

  1. Pattern 1 (w , h)
  2. Pattern 2 (w/2,h)
  3. Pattern 3 (w/2, h/2)

enter image description here

Two columns is pattern 2 or 3. Their width is a half of pattern 1. So the tablix can use only one column. Preparing dataset to be two column isn't compatible for this case.

Fame th
  • 1,018
  • 3
  • 17
  • 37

1 Answers1

0

You cannot, as far as I am aware, dynamically set the subreport name as an expression.

However, if you have all charts/tables in subreport_all, SSRS will execute each dataset even if the subreport is not visible.

You could a parameter to each dataset query that is set in the same way you decide on visibility so that it quickly returns an empty dataset for the datasets that are not required.

For exmaple, if you have a dataset that is something like.

SELECT ColumnA, Column B 
    FROM myTable 
    WHERE ColumnC = @someParameter

then you could rewrite it to something like

SELECT ColumnA, Column B 
    FROM myTable 
    WHERE ColumnC = @someParameter AND @pPatternNo = "A"

or even

IF @pPatternNo != "A"
    BEGIN
        SELECT CAST(NULL AS int) AS ColumnA, CAST(NULL AS INT) AS ColumnB
    END
ELSE
    BEGIN
        SELECT ColumnA, Column B 
            FROM myTable 
            WHERE ColumnC = @someParameter
    END

You will need to swap out the AS INT part to match your existing datatype, this is to ensure that SSRS always gets back the same structure from the dataset.

It's not ideal but if should improve the performance.

Alan Schofield
  • 19,839
  • 3
  • 22
  • 35
  • Sorry, I gave some Information isn't clear. Each pattern hasn't same width but I need to put it as same column of the tablix. – Fame th Mar 02 '22 at 04:04