Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 views
in Technique[技术] by (71.8m points)

sql server - 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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...