sql-serverreporting-services

Get Count of Shared DataSet when defined with a Parameter


I commonly display the number of rows of my datasets in SSRS e.g.

=CountRows("MyDataSet")

However this doesn't work when the dataset is a shared dataset with a parameter.

=CountRows("MySharedDatasetWithParameter")

Instead it throws an error:

The Value expression for the textrun 'Textbox25.Paragraphs[0].TextRuns[0]' contains an error: (processing): (null != aggregateObj)

How can I get the number of rows in this case?

The dataset "MySharedDatasetWithParameter" does work in normal circumstances, because I am using it to provide the available values to another parameter.

Example of shared dataset with parameter

select [Name], [Value]
from dbo.MyList
where MasterList = @MasterList

Solution

  • A workaround taken from this answer (Its not a duplicate question else I would flag it as such) is to create a hidden, multi-valued, parameter e.g. MyHiddenDataSetValues which stores the values from "MySharedDatasetWithParameter" and then

    =Parameters!MyHiddenDataSetValues.Count
    

    gives the number of rows.

    Rather clunky, so still hoping for a way to use CountRows.