subreport fails if main report does interactive sorting

I've been reading a lot of posts on this subject. I understand that the issue is due to the fact that the subreport is only rendered once. So after the main report is sorted on another column, the cell with the subreport produces an error.

What I want to know is whether or not this is considered a defect. And if it is a defect, is it fixed in another version?

I am currently running SSRS SQL2008R2 SP2 (20.50.4

April 16th, 2013 4:03pm

Hi JoLee,

This is a known issue in SQL Server 2008 R2 Reporting Services and SSRS 2012, and has not been fixed yet.

The problem occurs because the subreport has two parameters and the main report only provides a value for the first parameter.  The second parameter has a default value.  During the initial report execution, Processing triggers report parameter processing on the subreport.  This fills in the value of the second subreport parameter from its default value.  Interactive sort causes the report processing engine to reprocess the report according to the new sort order.  During the reprocessing, we do not invoke report parameter processing on the subreport.  This leaves the second subreport parameter without a value, causing the subreport to fail. 

Here, there are several workarounds for your reference:

  • Specify a value for all subreport parameters rather than relying on the default values in the subreport. This will allow Processing to match the subreport instances during the interactive sort step without relying on report parameter processing to fill in default values.
  • If the customer is using a report parameter with a default value simply as a way to reuse a calculation, they should consider using a Report Variable instead (http://technet.microsoft.com/en-us/library/bb934256.aspx). This will allow them to name a reusable calculation without having to rely on default values in report parameters.
  • If the customer is using the defaulted parameter somewhere where Report Variables are not allowed (i.e DataSet.CommandText) they may also consider using a custom code function in the Reports Code block (http://msdn.microsoft.com/en-us/library/ms155798.aspx). They can then refer to the calculation using something like =Code.GetFirstLetter(Parameters!pTestParam2.Value).

Regards,
Mike Yin

If you have any feedback on our support, please click here

Free Windows Admin Tool Kit Click here and download it now
April 18th, 2013 9:50am

Thank you very much. This does explain the problem. I am passing a calculated parameter to the subreport so that it can set the background color the same as the parent report.

Is there an alternative way of doing this?

April 18th, 2013 7:27pm

Anyone know if there is a Connect ticket open on this issue?
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2015 5:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics