Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Subreport does not diplay data

Author  Topic 

marina1966
Starting Member

10 Posts

Posted - 2008-04-17 : 10:44:37
I am new to the SQL 2005 Reporting Services.
A report, which I'm going to use as a subreport, itself runs well, got the data in preview mode, but when after I'm adding subreport to the main report, setting parameters in the properties(The main report and subreport have the same parameters)subreport does not display data and there no error messages. Please, if anyone know how to fix it, let me know.

MY

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-17 : 12:36:24
Have you tried executing the report your calling from subreport independently to see wwhether it shows any data?
Go to Top of Page

marina1966
Starting Member

10 Posts

Posted - 2008-04-17 : 12:46:00
Yes, I did. The report runs itseft and got data. When the report in the another report(subreport), shows only table header and blank details rows.

MY
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-17 : 12:55:05
That means there is some problems with passing of parameters to subreport. Can you check whether parameter values are passed correctly to subreport.
Go to Top of Page

marina1966
Starting Member

10 Posts

Posted - 2008-04-17 : 13:11:46
When I setting a parameters for subreport I have only option to select a field/parameter from the main report as a value. I think, this is a problem. Maybe, I have to select a value for parameters from the subreport, but I do not know, how to do this.

MY
Go to Top of Page

marina1966
Starting Member

10 Posts

Posted - 2008-04-17 : 13:33:41
I fixed the problem. I changed SUM(...) to First(...) in expession for Parameter Value for the subreport and modified the stored procedure for the subreport: I added one more field which has the same value as a parameter for a report,then I added this field to the table in a new column in the table in the subreport. All of this changes solved my problem and the subreport in the main report got data in it.

MY
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-17 : 13:36:06
Why are you using first(). You just need to pass the field value alone as Fields!YourField.Value
Go to Top of Page

marina1966
Starting Member

10 Posts

Posted - 2008-04-17 : 13:42:58
I have an option to select =Sum(Fields!PrID.Value, "EnhancedRegister"), I'm chanching it to =First(Fields!PrID.Value, "EnhancedRegister"). If I leave only =Fields!PrID.Value, and run the report, I have an error:Subreport could not be shown.

MY
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-22 : 14:18:38
Are you applying a grouping for your main report?
Go to Top of Page

bbasir
Yak Posting Veteran

76 Posts

Posted - 2008-04-23 : 19:16:59
you should have the data like this...

=(Fields!PrID.Value, "EnhancedRegister")

There is no need to add the First in the above statement.
Go to Top of Page

Zoma
Yak Posting Veteran

76 Posts

Posted - 2008-04-24 : 09:05:56
Hey Im also New to SQL Reporting Services But Try This;
That subreport you want to add,Try create a new report(which is that report) On that report you want to add subreport,Then Drag the report to the layout of the main report.
Don't know if it will help But i once had that problem,Thats how I did It.
Go to Top of Page

cgyq
Starting Member

7 Posts

Posted - 2010-02-06 : 04:31:08
I am having exactly same problem. My query that used for generating the dataset has to have sum() field. If I remove the sum, the parameter can pass the subreport. Otherwise no data was displayed other than the heading. Is there a way solve this problem if I have to keep the sum in my query?

Thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-06 : 06:04:07
what exactly are you trying to show in subreport? why you need sum()? also in future please post as a new thread rather than hijacking old threads. that will help you to get quick answers.
Go to Top of Page

cgyq
Starting Member

7 Posts

Posted - 2010-02-06 : 14:16:58
Say if I have main report with deptno and sum(sal)

DeptNo Sum Sal Rank
30 10300 1
20 9150 2

I want to have a detail report below:

Ename Job Sal
ALLENw SALESMAN 1600
MARTINe SALESMAN 6250
TURNER SALESMAN 1500
JAMES CLERK33 950

My query for the main report is
select deptno, sum(sal)
from emp

My subreport query is
select ename, job, sal
from emp
where deptno = @deptno

My subreport has parameter deptno and I set deptno=Fields!deptno.Value in the parameter property for the subreport within the main report

For some reason if I had the sum() in my main report (if I removed the sum, at least some data shown up but not what I want), the parameter(deptno) won't pass to the subreport as nothing but the header will show up. What I have done wrong then?

Thanks a lot for your quick reply!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-07 : 10:36:37
the expression used in main report has nothing to do with data shown in subreport. its only value you passed through jump to report or url that determines what data to be shown by report. what all params you're passing? only deptno value?
Go to Top of Page

cgyq
Starting Member

7 Posts

Posted - 2010-02-07 : 13:42:11
Yes, only deptno... if I use jump to report, it worked. Only the detail report shows up on the second page. If I want to use sub report and the result of the detail report shows up in the main report, it does not work. btw, my query in the main report was
select deptno, sum(sal)
from emp
group by deptno
I forgot the group by previously...

Thanks!
Go to Top of Page

cgyq
Starting Member

7 Posts

Posted - 2010-02-07 : 13:49:06
This is so wierd... when I run it again, data shows up now... I have not changed anything.

Well, thanks a lot for your help anyway!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-08 : 04:52:40
great. so it might have problem with caching on subreport
Go to Top of Page
   

- Advertisement -