cancel
Showing results for 
Search instead for 
Did you mean: 

Problem accessing data within a Crystal Report

0 Kudos

Hi,

we are using the crystalreportviewer model and a call of the form "ReportSource.Rows[x].Rows[0].DataRowView\['yyyyy'\]" to access the customer data within a report from a .NET C# application. x stands for the row number and yyyy is a name of a field present in the report. The report was designed with a single group (customer data like name, address etc.) and a detail area (phone numbers of the customers. For one customer may exist more than 1 phone number). These two areas are set to overlap. The data are fetched using the built-in query of the report (i.e. the query was created within the crystal report designer and it is not overwritten in our code. Going through the report rows works in most cases without a problem but for certain data rows I get an "out of index" exception for the "ReportSource.Rows[x].Rows[0]" statement (looks like the group details are just empty).

I have checked the rows the code works for and the rows for which the exception is thrown and could not really identify any differences that may be causing the problem. If you have any suggestions on this, I would be most grateful!

Cheers

Stratos

PS: No grouping operators are applied on the customer data but I guess this is not necessary since all rows fetched from the database within a group contain the same values for all customer attributes (except from the phone numbers)

Query:

select customer.name,customer.id,customer.address,telefon.number from customer,telefon where telefon.Id=customer.Id;

Report structure:

Group 1 (Group by customer.name + customer.Id): Customer.Name, Customer.Address ...

Details : Telefon.Number

Edited by: Efstratios Karaivazoglou on Sep 17, 2008 11:00 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Which Crystal report version are you using?

Is report works fine in designer?

Regards,

Shweta

0 Kudos

Hi Shweta,

we built the report using CR Designer XI R2 (Version 11.5.7.... I think it is with SP2). The report works fine in the designer and appears also correctly in the CrystalViewer window in our application. All we want to do then is to access the report and get some data out to store them in a database. This also works fine for almost all report rows, except for a couple of them where we get the exception. As said before we access the data using the ReportSource.Rows\[<RowNumber>\].Rows\[0\].DataRowView\[<Field Name>\] syntax.

Regards,

Stratos

Edited by: Efstratios Karaivazoglou on Sep 18, 2008 8:18 AM

0 Kudos

Hi,

we found the root of all evil: We are using a formula for grouping the data, based on customer name and number. In the database some customer name entries contain a slash ("/"). These rows were causing our problem since the Crystal .NET SDK was not able to access the related data. All we had to do it to add a replace operator in the CR grouping formula, replacing every slash with the minus symbol. Everything is working fine now and we can access every single line from within our .NET application

It seems that when "/" is contained in the return values of a grouping function the .NET API has trouble returning the detailed data contained in the group.

Cheers

Stratos

Answers (0)