SSRS PSA on Filtering Subreports Performance Fixing

I tried a variety of variations of the query syntax but all error out. I even took the whole query into SSMS and adjusted the statement to use the GUID and it works fine, so thinking I’m missing something else.

If I run the main report it’s just the generic “Error: Subreport could not be shown.”

Ending syntax:


WHERE T1.InvoiceNum = "+Parameters!InvcDtl_InvoiceNum.Value+" "

You’re saying I should add the Invoice Number parameter here?

Would that be applicable to a subreport, though?
All of those parameters he’s passing are pushed in from the main report, so they should be available to filter on within the query.

@Randy what happens if you remove the parameter and hard code an invoice number? Does it work then? That would confirm if the issue is with your parameter vs syntax.

Eureka!

If I hard code the invoice number the preview on the subreport worked but main report would still say “Error: Subreport could not be shown.” It was driving me :crazy_face: so I slept on it.

Today I kept working at it and trying various Google searches, finally found this article. Since both InvoiceNum and Company are columns in the dataset I changed the query where to:

WHERE T1.InvoiceNum = @InvoiceNum AND T1.Company = @Company "

Got another error that the parameters were not defined, "Must declare the scalar variable "@… " so I added them to the dataset’s parameters tab and Eureka!

7 Likes

Did you dream about the answer?

I think many of us have had dreams about work from time to time :nerd_face:

1 Like