petre ricardo

petre ricardo

  • NA
  • 194
  • 0

Why we should clear off the ParameterValues after asign a paramter values to "ParameterValues" collection in crystal reports!

Oct 19 2009 2:20 AM
 
ParameterFieldDefinitions paraFieldDefinitions;
ParameterFieldDefinition paraFieldDefinition;
ParameterValues paraVals = new ParameterValues();


ParameterDiscreteValue paraDiscreatValue = new ParameterDiscreteValue();
 
paraDiscreatValue.Value = tbxCustomerName.Text;


paraFieldDefinitions = rptDoc.DataDefinition.ParameterFields;
 
paraFieldDefinition = paraFieldDefinitions[
"customerName"];
 
//could "customerName" field parameter hold more than one value?
paraVals = paraFieldDefinition.CurrentValues;

 
//why we clear this? this will clear off the values that was assigned from the
//previouse line.
paraVals.Clear();
 
//add the parameter values to the collection
paraVals.Add(paraDiscreatValue);
 
//what happense here?
paraFieldDefinition.ApplyCurrentValues(paraVals);

 
Hi, i have included all my question under comments, they are few issues related to crystal reports, use of paramters!
TY

Answers (2)