How to pass Date parameter from Main Report to Sub Report In RDLC

Analyst_SQL 3,576 Reputation points
2021-10-09T12:20:19.89+00:00

I am trying to pass parameter from main report to sub report ,Data is displaying in Main report ,but not getting display in Sub Report error is coming
Error: Subreport could not be shown.

Below setting is done in sub report,i also followed below link
passing-a-date-parameter-from-master-to-subreport

139039-rrr.jpg

Main report Store Procedure

ALTER Procedure  [dbo].[Sp_Ret_Prd_Bales]  
  
@StartDate datetime,  
@EndDate datetime  
  
as begin  
  
;with cte1 as(  
  
select s.orderno orderno,c.CustomerName customer from SalesOrder s   
inner join customer c on c.customerid=s.CustomerID  
where Status='Open' and s.OrderNo<>139  
  
),  
cte2 as (  
  
select p.EntryDate, p.OrderNo, p.prdqty ,i.I_cat category,i.Descriptionitem ,i.BaleSize,s.Secnam, ISNULL(p.Weigth,i.weight) as Weigth from ItemMasterFile i inner join Probale p on P.Codeitem=i.CodeItem  
inner join Sections s on s.SecID=i.SecID  
where  (P.EntryDate between @StartDate and @EndDate)  and P.DelID is null  
)  
  
select EntryDate,Customer, isnull(prdqty,0)prdqty ,category,Descriptionitem,BaleSize Packsize,Secnam,Weigth from cte1 full outer join cte2 on cte2.OrderNo=cte1.orderno  
  
  
end  

Sub report store Procedure

ALTER Procedure [dbo].[SP_Summary_Category]  
  
@StartDate datetime,  
@EndDate datetime  
  
as begin  
  
  
select p.EntryDate EntryDate, i.I_cat category,sum(P.prdqty )qty,sum(ISNULL(p.Weigth,i.weight)) as Weigth  
from ItemMasterFile i inner join Probale p on P.Codeitem=i.CodeItem  
  
where (P.EntryDate between @StartDate and @EndDate)  and  
 P.DelID is null and I.Packsize='small'   
and p.OrderNo<>139  
  
group by I.I_Cat,P.EntryDate  
  
end  
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,631 Reputation points
    2021-10-11T01:25:08.68+00:00

    Hi @Analyst_SQL
    All parameters that are required by the subreport must be included in the Parameters list. If a required parameter is missing, the subreport is not displayed correctly in the main report. If you have properly set up the values you specified as parameters in your subreports then it should be no problem to send them from the master report.
    Note:Make sure you are passing the parameter from the main report to the subreport as [@paramName] and not "=Parameters!ParamName.Value(0)" as this indicates to retrieve only the first value.

    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.