Print Page | Close Window

crystal report shows only one row

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16363
Printed Date: 18 May 2024 at 9:54pm


Topic: crystal report shows only one row
Posted By: jone
Subject: crystal report shows only one row
Date Posted: 06 May 2012 at 9:01pm
Hello,
I am using crystal report to print a grouping grid control.
I am sending a dataset with 2 related tables like this:

ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath(rptPath));
rd.SetDataSource(ds);

the datatables have many rows
but when i show the report there is only one row(two related rows) in it.

can you please help me?

thanks in advance.



Replies:
Posted By: lockwelle
Date Posted: 07 May 2012 at 4:54am
does the report work in designmode?
while i haven't used multiple tables linked in CR this way, I have used a single table with lots of data and a second table for options (a wizard generates the options and the data).
 
i am assuming that the report is set for ADO.net for the datasource and that you have linked the tables in the report. If they are unlinked, I would only expect 1 record as CR doesn't know how to advance through the record set.


Posted By: jone
Date Posted: 07 May 2012 at 6:45pm
i'm new with CR.

could you please explain me particularly
what i suppose to do?
how can i know if i'm on design mode?
and how can i check if i'm doing the right thing?

thanks


Posted By: lockwelle
Date Posted: 08 May 2012 at 4:53am
design mode is what you see when you initially open the CR environment.  When you hit the preview button, then you are not in design mode IMO. Yes you can move items around and change formulas, but it is supposed to be mimicing the display. 
 
Another way of looking at it, and this is if your report is called from an application...when the application calls it, it is not design time but run time.
If you never use an application, then you are probably always in design time as you can change the report.
 
I guess that is the easy way of looking at it, if you can change the layout or functioning of the report, you are in design time, otherwise you are in runtime.
 
so what I am asking is can you click on the preview button for your report and see the report as you envision it is suppose to be displayed. If the answer is no, then the report doesn't work. If it works when you hit the preview button, but not when you call it from the application, then one would suppose that the data being sent from the application is faulty, but if doesn't work in design, then it doesn't work and it is not the application...
 
so in short, I'm trying to determine where one should start looking to find the error.
 
 


Posted By: jone
Date Posted: 08 May 2012 at 7:26pm
when i'm on preview mode I can see the report the way it suppose to be displayed, but without the data (which i'm sending from code), only 2 rows of headers:1 for parent Table and 1 for child.

and when i see it from running my application - i see this headers with only one (the third) record of the grouping grid (double record)


Posted By: lockwelle
Date Posted: 09 May 2012 at 3:55am
here is how I design/debug reports where I push the data to the report.
stop the app right before you set the DataSource on the report.
use the variable.WriteXML("filename", writeSchema).
 
Now in the report, the datasource should already be ADO.Net, set the path to point at the file you just wrote out.  Now when you hit preview, the report will read the file, and you can start debugging.
 
if you change the datasource, you will need t go into Data Expert, right click your connection and refresh each table. Then go into the report and Verify Database...then when you preview, you will see your new data. 
 
HTH


Posted By: jone
Date Posted: 12 May 2012 at 7:33pm
could you please show me an example, from code and from the CR environment?



Posted By: jone
Date Posted: 20 May 2012 at 7:26pm
Hi.
i'm still stuck with this problem,
can you please help me with examples?


Posted By: lockwelle
Date Posted: 21 May 2012 at 3:53am
there isn't really an example that I can give...I write out the data file and then use that as my datasource for the report.
 
the steps are described in previous posts.
create/change the datasource to be an ADO.Net connection that points to your XML file that has both the data and the schema, and go from there...then it's just like any other Crystal Report.



Print Page | Close Window