Reputation: 10650
I have one dataset (DataSet1) in main report. The main report contains a subreport (child report). I would like to know how can I pass rowcount of dataset (DataSet1) in main report to subreport (child report). DataSet1 returns 1, 2 o 3 rows depending on a parameter on the query.
I have used a textbox in main report and assign it the expression:
= RowCount("DataSet1")
then I pass the value of this textbox to the subreport (child report) as a parameter using the expression:
= Reportitems!textbox1.Value
The subreport (child report) within main report is contained in a list object. This list object has assigned the DataSet1 over which it iterates.
Within subreport I print in a textbox the value of the parameter passed from main report (rowcount("DataSet1")) but it always prints value of 1 instead of print 1, 2 or 3 depending on the case.
Also I have tried to create another dataset2 which contains the same query as dataset1 but returning SELECT COUNT(*) AS rc ..... Then outside of the tablix I create another textbox and I assign to it the expression:
= First(Fields!rc.Value)
In the textbox is correctly shown the value of count 1,2,3 depending on the case but when passing it as parameter to subreport, in the subreport it is always shown as 0.
What am I doing wrong?
Upvotes: 0
Views: 1197
Reputation: 66
Instead of setting a textbox with the row count and passing that value to the subreport, could you try passing the parameter directly to the subreport. ie. =CountRows("DataSet1") in the 'Change subreport parameters' dialog?
Upvotes: 1