Print Page | Close Window

Crystal report showing Multile record

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9794
Printed Date: 04 May 2025 at 11:16pm


Topic: Crystal report showing Multile record
Posted By: Santokh singh
Subject: Crystal report showing Multile record
Date Posted: 22 Apr 2010 at 9:08pm
Dear all,
             I have created a report using a stored procedure which expects some parameters i Have passed the required parametes but report is displaying 9 time a single record can any body suggest me wt to do in that case and code for that is like that below:
 
Its too urgent so please reply fast ASAP.

ReportDocument reportDocument = new ReportDocument();

ParameterField paramField = new ParameterField();

ParameterFields paramFields = new ParameterFields();

ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

//ParameterFieldDefinition parmfldDefn;

//Set instances for input parameter 1 - @vDepartment

paramField.Name = "@EndDate";

//parmfldDefn = reportDocument.DataDefinition.ParameterFields[0];

//Below variable can be set to any data present in SalseData table, Department column

paramDiscreteValue.Value = EndDate;

paramField.CurrentValues.Add(paramDiscreteValue);

//Add the paramField to paramFields

paramFields.Add(paramField);

//Set instances for input parameter 2 - @iSalseYear

//*Remember to reconstruct the paramDiscreteValue and paramField objects

paramField = new ParameterField();

paramField.Name = "@Date";

// parmfldDefn = reportDocument.DataDefinition.ParameterFields[1];

paramDiscreteValue = new ParameterDiscreteValue();

paramDiscreteValue.Value =Convert.ToString(Convert.ToDateTime(EndDate).AddDays(10)

.ToString("dd/MM/yyyy hh:mm"));

paramField.CurrentValues.Add(paramDiscreteValue);

//Add the paramField to paramFields

paramFields.Add(paramField);

crystalReportViewer1.ParameterFieldInfo = paramFields;

reportDocument.Load(Path + @"\Tamper Analyzer\Reports\Instantaneous Report.rpt");

//set the database loggon information.

//**Note that the third parameter is the DSN name and not the Database or System name

//reportDocument.SetDatabaseLogon(

//Load the report by setting the report source

crystalReportViewer1.ReportSource = reportDocument;

Thax regs
Santokh singh


-------------
Rgds
Santokh Singh



Replies:
Posted By: hilfy
Date Posted: 23 Apr 2010 at 10:56am
If the stored procedure provides the only data in the report, there are two options that I can think of:
 
1.  In the report, go to the database menu and turn on Select Distinct Data.
 
2.  Modify the stored procedure to return distinct records.
 
However, if the stored procedure already returns disctinct records and is just one of several data sources for the report, you're probably seeing the duplicate records because of the one-to-many relationships with one or more of the other tables in the report that make the actual SQL not return distinct records.  In this case, the best way to handle the situation is to group on a field or combination of fields that identify a distinct record.  Put the data that's now in your details in either Group Header or Group Footer sections.  If you're using any summaries (sum, count, etc.) you'll also have to rework them because they'll be inflated due to the multiple records.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Santokh singh
Date Posted: 23 Apr 2010 at 8:11pm
Dear Dell,
               Thanks for you valueable time that you gave to the discussion.
 
Actually stored procedure that i am using has relation between two tables and returning records and thise recordds are already distinct.
may be grouping the field will help  me.
Thax.
               i ll just try it out and tell you that.


-------------
Rgds
Santokh Singh



Print Page | Close Window