crystal report, subreport details section not displaying the next batch of records - crystal-reports

I put a subreport in the footer of my main report and I set its details section to display five records per page (through the paging tab).
I am sure my query returns nine records.
Upon previewing the report, on the first page, it displays the first five records.
However, on the second page, it also displays the first five records not the remaining four records.
I am not sure where is the problem since I just started using crystal reports. Hope you can help me. Thanks.

You need to set your sub report links.
This will link the data from your main report to your sub report. In Crystal 2008 you right click on the sub report and choose 'Change Sub report links...' option. Then you can select the data to flow from the main report to your sub report. Otherwise your sub report is being viewed as a completely separate report that you are just inserting on top of your main report and it will be the same at every instance.
Also, it might be a good idea to use groups instead of the details section when inserting sub reports.

Related

Linking fields to subreport

In my main report I have some fields which I need to use in my subreport.
Right now I'm loading one csv file in both the main and the sub reports, but this seems to slow down the preview of my reports (I need these reports in a program). Eve if I use the preview in Crystal Reporst, it loads 3 times the same database, so I was thinking about linking the fields.
So I do Right Click on Subreport -> Change Subreport Links... and then I put the fields I want on the right side of the shown table. But when I do a preview of the whole report, in the subreport it shows only the first line and not all the values inside.
How do I manage to make the subreport show all the values of the fields?

Crystal Subreport Common Headers

Maybe someone can Help me find the right technique.
I have a number of Crystal Reports that I am updating (Crystal Reports XI).
These reports each have an SQL Function associated with each that either retrieves records from the database (if any meet criteria) or returns an Empty Dataset (which happens daily).
These are executed in a batch process and directs the output to a PDF file which is emailed to users.
I am relatively new to Crystal Reports.
I am attempting to use a common SubReport to format/gather data for the Headers/Footers used in these documents. So far - most of this is working as I would expect. This allows me to use a single SubReport to generate the same Header/Footer in multiple reports (at least that's my goal).
However - I added a Report Footer section to the Main Report - my plan with this was to generate a Report Footer that would contain the following information:
A static Text Message that reads " --- END OF DOCUMENT ---"
The Report Title of the "Main Report"
The Date and Time that the Document was generated and Total Number of pages.
Sounds pretty simple.
So SubReport is named: "END-OF-DOCUMENT-SUBREPORT"
I used the "Special Fields" Data Date, Data Time, & Page N of M
Since the "Special Field" Report Title is returning me the "END-OF-DOCUMENT-SUBREPORT" value I used a Parameter field to pass the Report Title value from the Main Report to the SubReport.
This all works fine - HOWEVER - with the addition of the Linked Parameter Field from the Main to the SubReport - when I execute the report to generate the document - the SubReport ends up showing a blank Report Footer - that I can click on to reveal the "END-OF-DOCUMENT-SUBREPORT" in another Tab.
Without the Parameter field - it didn't do this and the information from the SubReport appeared on the last page of the document.
Is this a standard behavior of Crystal?
I'm not sure how to Suppress the "Drill Down" feature and still display the Report Section.
You can pass variable between you Main Report and sub Report. You can also create variable and assigned them to a sub report. As aMazing mention, creating Header and Report Footer sub report is not common. It is even messy. If you want something generic, I will create a report template that you will use in the future.
Have a good day!

Break Detail Line in Half?

Currently the detail prints like this:
I want to break the line in half like this:
This is what I have; Not what I want
Notes:
This is all in a sub-report if that makes any difference
I do not yet grok using formulas, variables, etc. to influence what is printed where, when, or how.
I'm working in Visual Studio 2012, I don't know the CR version.
I created Detail a and Detail b sections.
I created 2 Group Header Sections: Group Header 1a and Group Header 1b
I moved all the headers into these two groups and suppressed the Report Header Section (but not the Report Footer). Moved report fields into corresponding detail group.
Now all the detail is printed after both headers are printed. I expected this but don't know how to do what I need.
Totals are printed in the Report Footer, no issues here.
The Mystery is Solved
Created a 2nd sub report
Moved desired headings, details, and totals to the new sub report ReportHeadr, DetailSection, and ReportFooterSection respectively.
Put the new sub report directly below the original in the same (main report) section - it just happens to be a GroupHeaderSection
Changed SubReport Links ... for the new sub report. Set it identically to the original.
Notes
The sub report links setting is key to making this work. Otherwise I was getting all the data records every time this new sub report was generated, resulting in hundreds of pages.
Could not use Siva's answer. The sub report happens to be inside a Main Report's GroupHeaderSection. The report's structure does not make putting the (sub report) content into new groups and detail sections possible.
I did create multiple groups & detail sections in the sub report itself. This still gives me the undesired results illustrated in the original question posting.
if you need to view the output as you required follow below
1. Take 2 detail sections add two sub reports in main report.
2. In sub report 1 place first 3 columns and in second sub report place other two columns

Active reports subreport multiple pge issue

I am using Active reports to generate a report.
The maiin report has 4 grids. For first 3 grids I am using sub reports and for the last grid , the main report is used.
Now the problem is if the records in sub report is spanning across multiple pages, the whole report is being displayed multiple times. However if the sub report has , say some, 20 records, the report displays each section just once.
FYI, in the details section I have an image which is supposed to be displayed only once when the report is run, followed by 3 grids ( 3 sub reports) and a grid(not a sub report).
In the report start event, am initialising the subreports like
subreport1 = new SubReport1();
In the report end event am disposing it like
subreport1 = null
and in the details_Format event of the main report, am
DetailedReport.Report = subreport1 ;
Please help me in resolving this issue at the earliest.
What other code do you have in the reports' events? This is almost certainly caused by changing some setting or changing the data/query in the subreports from an inappropriate event. All settings or changes made to the subreport should be done in the Format event of the section containing the subreport control.
Also, although not a problem in Detail_Format (assuming all your subreport controls are in the Detail section) you should be able to do the DetailedReport.Report = subreport1 and similar statements only once in the main report's ReportStart event. Probably no noticeable effect, but it should simplify the code slightly and remove the redundant SubreportControl.Report.set calls.

Report crashes

Hi I am trying to have a master detail report. But the report always crashes as i hit the next page on the preview. Both the queries work fine in the query editor.
Main report query
select a.Name,a.ftid,a.instno from testschema.ViewA a where a.ftid={?ftid}
Shared variables declared in main report separately
shared numbervar instno;
instno:={Command.INSTNO}
shared stringVar gnpidesc;
gnpidesc:={Command.Name}
Sub report query
select a.TOTALAMT,b.Name from testschema.ViewB a CROSS JOIN testschema.View3 b where a.ftid={?ftid} AND b.ftid=a.ftid AND b.instno={?instno} AND a.Name='{?gnpidesc}' ORDER BY a.GENGNPIDESC
Shared variables declared inside subreport header separately
shared numbervar instno;
shared stringVar gnpidesc;
I have delcared 3 parameters fields also with the same name.Sub report only shows for first row in master, if I click next page the application crashes.
Edit
The Sub report contains a cross-tab report in the sub report head section.
Report Layout
Main Report
- Details Section (Main report query)
- Details Section2 (Sub report)
- Cross-tab (Sub report Footer- Query 2)
Main Report
I'm certain I've seen this before with my own reports. You probably have some data quality/consistency issues.
Do any of your joining fields have a null value? All it takes is 1 record ;)
Do you have a formulae that references a field with a null value?
I don't know what your data source is, but do any of those views have custom formulae that Crystal wouldn't recognize? For example, I often pull data from MS Access queries, but Crystal throws an error if I use the nz() function.
One way to find your culprit is to scroll through your preview until you find the page that can't display and crashes. See what data would have displayed on there.
You'll have to either fix the data before it gets to Crystal or rework a function. Good luck.