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;
}

Kavi sujaPosted Jul 25, 2013, 7:03 AM
Iftikar HussainPosted Jul 25, 2013, 6:52 AM
Regards,
Iftikar
Kavi sujaPosted Jul 25, 2013, 6:50 AM
Iftikar HussainPosted Jul 25, 2013, 6:42 AM
Regards,
Iftikar
Kavi sujaPosted Jul 25, 2013, 6:38 AM
I try that method in Row visibility of main report.It generate following error.
"The Hidden expression for the grouping 'Details' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset."
I again try this method --> IIF(Count(Fields!pkey.Value,"GenerateReport")=0,"False","True").But the same error shows..
Iftikar HussainPosted Jul 25, 2013, 5:30 AM
You can set row visibility condition in RDLC. Go to the particular row for which doctor name is getting displayed and set visibility condition as
=IIF(Count("PaitentId","DataSet2")=0,False,True)
Regards,
Iftikar