tedmanowar 0 Newbie Poster

Hello,

I am trying to add some reporting features to a quite large asp.net web application. I have created a webform that contains a few fields for filtering data to be displayed in a Crystal Report.

I have created a sample report that has a few parameters but I cannot get any data returned to me if those parameters don't have values.

Is there a way for Crystal Reports to ignore parameters that don't have a value specified?

Or alternatively, is there a way to just change the set of data (maybe with the use of a System.DataSet) that the report displays at run-time?

This is the code that i am using in order to pass the parameter values. If there is no value specified I use a different report that doesn't expect parameters simply because I get an error if I don't...

CrystalReportViewer1.ParameterFieldInfo.Clear();
if (docNumTxt.Text.Trim().Length > 0)
{
   CrystalReportViewer1.ReportSource = Server.MapPath("ReportWithParam.rpt");
   ParameterFields ParamFields = CrystalReportViewer1.ParameterFieldInfo;
   ParameterField p_docID = new ParameterField();
   p_docID.Name = "p_DOC";
   ParameterDiscreteValue p_docID_Value = new ParameterDiscreteValue();
   p_docID_Value.Value = docNumTxt.Text;
   p_docID.CurrentValues.Add(p_docID_Value);
   ParamFields.Add(p_docID);
}
else
{
   CrystalReportViewer1.ReportSource =    Server.MapPath("ReportWithoutParam.rpt");
}

Thanks in advance, I know my knowledge on the subject is sub-standard however I have a very important deadline coming up and I really need some help.

TedManowar

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.