Kavi suja

Kavi suja

  • NA
  • 298
  • 167.9k

RDLC - Parameters Main Report & Sub Report

Jul 25 2013 4:52 AM
HI,
   I have main report generating Doctor name using Doctor's ID.Then I add subreport for that.Here,the report generated for each doctor's patients list.In subreport,the patients are generated for each doctors using Doctor's ID getting as parameter from main report.During report generation,the patients list are generated for particular patient.If the patients are not available for particular doctor then doctor name only visible.(Here Doctor name generated from MainReport).Here I want to generate the doctors name ,those who have the patients list.If the patients are not available then that doctor name should not be displayed.Can any one help me to do this?


I include the code here.
  protected void btnSubReport_Click(object sender, EventArgs e)
        {
 DataTable dtbl = new DataTable("DataTable1");
                    int dID = Convert.ToInt16(ddlDoctor.SelectedValue);

                    ReportBLLogic objRptBLL = new ReportBLLogic();
                    dtbl = objRptBLL.GenerateMainReport(dID, "GetDoctorListByParam");

                    ReportViewer1.Visible = true;
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.ResolveUrl("ReportByDoctor.rdlc");
                    ReportDataSource source = new ReportDataSource("dsGetDoctor", dtbl);
                    ReportViewer1.LocalReport.DataSources.Add(source);
                    this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(Page_Init);
                    
                    // set parameters 
                    ReportParameter[] RptParam = new ReportParameter[7];
                    RptParam[0] = new ReportParameter("GeneratedDate", txtdate.Text);
                    //RptParam[0] = new ReportParameter("GeneratedDate", txtdate.Text);
                    MySqlDataReader HospitalName = objRptBLL.GetOrgName();
                    HospitalName.Read();
                    RptParam[1] = new ReportParameter("name",HospitalName["organization_name"].ToString());
                    RptParam[2] = new ReportParameter("address",HospitalName["address"].ToString());
                    RptParam[3] = new ReportParameter("city",HospitalName["city"].ToString());
                    RptParam[4] = new ReportParameter("code",HospitalName["code"].ToString());
                    RptParam[5] = new ReportParameter("country",HospitalName["country"].ToString());
                    RptParam[6] = new ReportParameter("phone",HospitalName["phone"].ToString());
                    this.ReportViewer1.LocalReport.SetParameters(RptParam);


                   // ReportViewer1.PageCountMode = PageCountMode.Actual;

                    ReportViewer1.LocalReport.Refresh();
                    ReportViewer2.Visible = false;
                    rfvfda.Enabled = false;
                    rfvdate.Enabled = true;

For SubReport Generation:
 public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
        {
DataTable dtbl = new DataTable("DataTable1");

                DateTime dt = Convert.ToDateTime(txtdate.Text);
                int dID = Convert.ToInt16(e.Parameters["prmDoctorID"].Values[0]);             

                ReportBLLogic objRptBLL = new ReportBLLogic();
                //dtbl = objRptBLL.GenerateSubReport("GenerateDoctorSubReport");            
                dtbl = objRptBLL.GenerateSubReport(dID, dt, "GenerateReport");
                e.DataSources.Add(new ReportDataSource("dsReportDate", dtbl));

               // ReportViewer1.PageCountMode = PageCountMode.Actual;

            }











Answers (6)