Page Break in SubReports in Crystal Report - crystal-reports

Description
I have Crystal report with Sub Reports in Detail Section of Main Report.
The sub reports are dynamic (n number depends upon Data in Data source)
Each sub report contain Image (one image per sub report)
Problem
Sub reports are generating dynamically. let suppose 5 sub reports . The problem is the sub report footer is showing on last sub report.
What I want
I want to display sub report footer on all sub reports .
What I tried
checked / unchecked Keep Together option on detail section of main
report
checked / unchecked Keep Object Together on Sub Report
Page Break after 1 Record Option on Sub report Expert Section

Related

CR2008 Suppressed SubReport's parameters are showing on main report

I am a very new user to crystal and have taken over a project that someone else has done and left.
Here is my current issue. I have a Main report that has a ton of sub reports on it. There is one sub-report that is suppressed that is causing a parameter prompt on the main report. I have looked through documentation about the links from main to sub but there is no link between these sub-report parameters and the main report. Also the sub report uses these parameters in the report itself. IE start date - end date are the parameters and are used on the sub report so I can't just remove them. How can I stop the prompt for these two parameters from the sub-report in the main report?
Thanks a Ton.
In the end I created a new report and just did not include the sub report mentioned. Thanks.

Why crystal reports sub report does not display some fields on viewer

I have crystal report with main report and sub report. Main report contains group sections.
I have linked sub report with main report using id. When I preview it on preview tab, both main and sub reports are working and displaying correct data.
But, when I preview it on the viewer with my application, main report data shows correct, but some sub report fields are not visible. I have noticed that, when I put the ID field to view in sub report, it shows a number of records. but only ID field is shown, and other fields are not visible.
I have set two record sets to main report and sub report. it seems records are returning data, but sub report does not shows them. Can anyone please point me in right direction to solve this?
Not sure how you are loading your report in the Crystal viewer, but keep in mind that if your report uses subreports, in your code when you are loading the report, you need to also set the data source for each subreport. See the following incomplete code snippet:
//SET DATASOURCE FOR EACH SUBREPORT IN REPORT
foreach (CrystalDecisions.CrystalReports.Engine.Section section in CrystalReportSource2.ReportDocument.ReportDefinition.Sections)
{
// In each section we need to loop through all the reporting objects
foreach (CrystalDecisions.CrystalReports.Engine.ReportObject reportObject in section.ReportObjects)
{
if (reportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject subReport = (SubreportObject)reportObject;
ReportDocument subDocument = subReport.OpenSubreport(subReport.SubreportName);
foreach (CrystalDecisions.CrystalReports.Engine.Table table in subDocument.Database.Tables)
{
// Cache the logon info block
TableLogOnInfo logOnInfo = table.LogOnInfo;
// Set the connection
logOnInfo.ConnectionInfo = crConnectionInfo;
// Apply the connection to the table!
table.ApplyLogOnInfo(logOnInfo);
}
}
}
}

Crystal reports subreport data should appear in the last page

I have a report which has many sub reports. In one of the sub reports, there is a formula which says
"if the text data is more than 500 charcters, it will spill over to the next page" .
What I want to do is, if the data in the sub report exceeds 500 characters, it should apper on the last page of the report, not the next page. A new page should be generated at the end of the report and that data should appear on that page.
one wayout would be:
Take the sub report in saperate section and force it to conditionally supress and display in last page.
Go to the section expert of the section and then to the formula editor.
if (PageNumber=TotalPageCount)
then true
else false
Go to Section expert Paging tab there X-2of New page Before
if (PageNumber=TotalPageCount)
then true
else false

Crystal reports no data lable

I have a report containing some sub reports and in my main report i am showing the sub reports based on scan mode and status coming from query.
Now i need to show a message whenever sub reports don't have data.
I tried like this.
checked supress blank sub report and supress blank section for all reports.
1.Kept a text box in report footer of main report.
2.Took a field (Say Barcode) from sub report and passed to main report using shared variable.
3.In section expert of text box wrote like this.
not isnull(Barcode)
But it is not working.
Please suggest.
If I have understood this correctly the code below should work. Tip, avoid using NOT ISNULL. If possible just change the outcome order of your IF statement as below.
To make your formula more robust also, it's a great idea to add in the:
OR = ""
To account for any blank entries.
Final code:
IF Isnull({Barcode}) OR {Barcode} = "" THEN FALSE ELSE TRUE

iReport, subreport does not appear

i'm trying to add subreport to report.
I have setted connection type to "use a connection expression" and the expression is $P{REPORT_CONNECTION}.
My subreport contains a simple query and some static text, when i test it all works good, but when i test mainreport the subreport does not appear.
I have some static text in subreport, this one should be display always, isn't true? But i can't see it...
During compilation i have no errors, and subreport path seems correct becouse a message say "subreport.jrxml already compiled.".
What can i do?
Thanks.
The solution is pass HIBERNATE_SESSION as parameter from master report to subreport.
Please Right clik on sub report and clik on open sub report if your sub report gets open then your reporyt is connect with your sub report. if subreport is not open do the right connection for that.
if your subreport is work for the parameter value with seperatly and displyes the static text and detail band values it is sure that the report will come ffrom main report.
but the report displays only static text and the text is in title or page heder, then you have to go to the report property and set the output when no data then choose diplay all section data from combo. your static text will apper from main report.
When you add a sub-report in your main report, the sub report expression will refer your locally saved sub-report path. Ex: "C:\abc\xyz.jrxml".
Now you can preview your main report containing sub-report in your ireport.
Once you publish the main report in Jasper server, the Sub report gets loaded into jasper repository and its expression becomes "repo:Repositorypath.jrxml".
Once sub-report contained report is published into Jasper repository, its path will always refers to Jasper repository path and because of this reason, you will not be able to Preview the main report in Ireport.
So, execute the report in jasper server directly once you publish the main report instead of previewing or opening the subreport in Ireport.
Thanks,
Srikanth Kattam