Crystal Report - Hide specific pages - crystal-reports

I have develped a crystal report. It must have 4 pages as default and additional 2 depending on the condition.
When the condition is success its showing all the text objects in 5th and 6th pages correctly, but in else condition, its displaying 4 pages with appropriate data and empty pages having page header in last 2 pages.
How to suppress/completely hide last 2 pages?
Pls advice
Thanks

Your best bet would be to create a report with multiple report footer sections. You can then either adjust each report footer section to be 1 page high and add the relevant conditions and objects or alternatively add a subreport to each report footer section containing the fields/logic.
I would probably create 8 report footer sections (2 being blank) then decide whether to show the 2 blank ones or the 2 with relevant objects.

In section expert, next to suppress use the below formula
if pagenumber in [99,100] then true
else false
Note; Assuming 99 and 100 are last 2 pages of the report.

Related

Crystal Reports 2016 - How to display multiple tables?

I am actually stuck with a multiple tables problem. I want to display 2 tables in my report.
I saw how to do it with C# but I am not using C#, only Crystal Reports. So I have to manage to do it inside Crystal Reports. Is there any way to do it other than use 2 sub reports?
Because from what I understood (I am very new to Crystal reports): to make a table, you have to put the header of the columns in a Header section and the datafields in a Details section.
But when you create sub groups, you can't add Details sections to each group, right?
What I want is something like that:
Example of what I need
How should I organize my report (in the section expert) to manage such a thing?
Thank you very much to anyone that can help!
You may be overthinking the details sections. When you group data in Crystal Report you get a Header and Footer section for each grouping level. So if you have 3 grouping levels, the report has the following sections.
Report Header
Page Header
Header 1
Header 2
Header 3
Details
Footer 3
Footer 2
Footer 1
Report Footer
Page Footer
In this report layout the details section contains detail records for Header 3 data. The data for Header 1 is detailed in Header 2, and the detail for Header 2 is found in Header 3.
The table layout you want to use is probably going to require at least 1 subreport. You may be able to pull the data for the first table along with the report data that is a higher level than tables, but you may need to do 2 subreports to prevent duplication of the data. I would focus on getting each table working in individual reports first, then you can link them into another report as subreports once you have both tables displaying the way you would like.

Crystal Reports: 4 pages, 1 report, 4 different headers

I am having troubles creating CR report with multiple pages.
What I am trying to achieve is:
Page 1: report
Page 2: same report with different header
Page 3: still same report as page 1 with different header
Page 4: same analogy
Now my reports is designed for 1 page.
Any tips? I'm little frustrated ATM...
You're going to need 4 Page Header sections. Each section will use a formula to be suppressed based upon the page number of the report. Each Page Header will be configured in the unique design needed for each of your 4 pages.
If you only have 1 row of data in your database that needs to generate all 4 reports, then you will also need 4 Details sections that use the same formula to be suppressed by page numbers. The design of the details sections will all be identical.
At some point you will also want to set the "New Page After" check box on a section. This can be done on each of the 4 details sections, or in the Page Footer sections if you use them. If you use Page Footer sections, they will likely need to use the suppression formula by page number as well.
This setup will yield 4 pages of the same data on each page, with unique page headers.
The complexity of your suppression formula will vary depending upon how much data you plan to print with each run of the report. If it will only be 1 report with a total of 4 pages then the formula will be rather simple since you only need to check for 4 possible values of PageNumber. If you plan to print multiple reports in this manner per run, then you need to check for PageNumber values that are multiples of 4 + n, where n is either 1, 2, 3, or 4. This still isn't an incredibly complex formula, providing you are 100% certain that none of the 4 pages needed for each row of data will ever exceed a single page. If that happens, the complexity of the report becomes much greater.

How to use a report as subreport (with additional info) multiple times in a maintainable way?

So basically I have a report. I need this report to be printed as a 'set of reports'. Except that for each time the report is printed, there has to be a specific numbering at the bottom of the page. Where it would look something like this:
Page 1: Report + Page footer text 'Number 1'
Page 2: Conditions
Page 3: Report + Page footer text 'Number 2'
Page 4: Conditions
Page 5: Report + Page footer text 'Number 3'
Page 6: Conditions
And so on, for an undetermined amount of times..
In order to achieve this, I have created a main report, which currently contains 20 subreports, in order to achieve 20 pages (but I really I'd like this to be dynamical, maybe to be able to set the number of copies or something). Where each subreport consists of the single mentioned report (through the subreport 'Choose an existing report' option), with a custom text at the bottom.
The problem with this is that I can't maintain this. Every time an adjustment needs to be made to the original report, I will need to access 10 subreports and make the very same change or reload the report into this subreport.
What alternative ways of achieving my goal can you suggest, because this feels really 'dirty'. Thank you for reading.
I run Version 14.0.2.364 of Crystal Reports 2011
To achieve this, you need to use group and detail section in main report. For making adjustments with paging, each section has his own
page before
page after
reset page
So to help you a bit, you need to have your data in one datasource, and group by
Report/Conditions. For each group you can have only 1 subreport which will have link for that specific subreport (e.g. where barcod of smth is 1234) and there show your subreport data. For page number i would advise you to use my approach (for grouping) and then for page number you display group number (and that solves you all formulas for calculating pages).
If you are not familiar with grouping in Crystal, you can group your records in report by some fields by following image below
To summarize, try to define by which fields your reports has 20 subreports (probably some keys from database) and then group by that fields, examine advances of section expert and paging and you should be done in few hours making your report readable and easy to maintain.
Hope it helps

Set size of detail section in Crystal Report

I m generating Bill report using crystal report in VS2008..in that, details section size is dynamic.
i.e. depend on number of records, it changes. so if I've 10 records the report view is full page that is k ..but if i have 2 records in details sections, then whole page footer section getting stick to details page..so whole alignment is getting change
so is there any way to set details section fixed i.e. for 10 records and if records exceed more, then all records on same page and remaining data will go on next page i.e report footer,page footer.
Is there any setting in crystal report
Ok, i can give you some tips on how you can approach your desired outcome.
The Crystal Reports engine has the following characteristics.
The Report Header appears on the top side of the first page only.
The Page Header appears on the top side of every page (on the first page it is under the Report Header).
The Report Footer appears only once, on the bottom side of the detail section on the last page.
The Page Footer appears on the bottom side of every page.
There is a capability in every section that allows you to suppress it if you don't need it. It can be done by right clicking the bar of the section that you want to suppress and pressing the suppress choice from the menu that will appear.
Consider the 2 following cases.
If you want to achieve the first case, change the height of the Page Footer to a value that will allow only 10 records to show on the Details section, include all the footer information in the Page Footer and suppress the Report Footer. If you want the same result but with the footer information appearing only on the last page, right click the bar of the Page Footer and select Section Expert. From there, press the x+2 sign next to the Suppress CheckBox and add the following code there.
if pagenumber <> totalpagecount then
true
else
false
If you want to achieve the second case, change the height of the Page Footer to a value which will allow only 10 records to show on the Details section and include all the footer information in the Report Footer section.
In both cases the Report Header is suppressed.
Go to Section Expert
select report footer
Tick the Print at bottom page and Keep together option
Problem will be solved
First of all fix height detail section by right click on detail section Detail Section->Section Expert click on paging Tab->Check in New Page Before checkbox and beside it (x+2)button write formula-> (Suppose you want 8 rows to display in your report per page and additional rows(9th row,10th row and so on... to another page) IF Remainder (RecordNumber, 9) = 0 THEN TRUE ELSE FALSE so now your height is fixed.. and for blank rows suppose 2 records/rows are coming from data table/data source then from 8 fixed rows , 6 rows should be blank rows for that.. design your detail section with fields and keep report footer(section 4) blank with with some spaces(i want 8 rows fixed so keep size of 8 rows blank assuming in report footer) and put footer details in your section 5(page footer)..
if your header or footer is not visible on another page then put all header parts details in page header and footer details in page footer
:)

Set the height of Details section Crystal Reports

The no of items in my invoice never gets more than 10. When its only one item in invoice(one row in details section) the report footer shows very up.
I want that I should fix 10 rows for the details section, when there are less rows, the remaining rows to make it 10 should be showed as blank lines.
I need the footer to appear at the same place all the time, irrespective of how many items are there in the invoice(never gets more than 10).
Please suggest solution.
Just use Sub Report and Fix the height of the sub report
then you will be able to display fix page.
I am not exactly sure what you are asking, but I will make some guesses with possible solutions.
If you print multiple invoices per report, you can group on the invoice designator, and set the report to start every invoice on a new page. In addition, you can force a new page when the record count goes over 10 rows. There are various ways to do this, but the simplest would be to add a counter that is set/reset at the start of an invoice, and then conditionally force a "new page before" if that counter reaches 11. You can also set this to force a new page for every n + 1 records (the 11th record, the 21st record, the 31st record, etc.)
If you just don't want the report footer to show up, you can either suppress it or issue a "new page before" on report footer. This is handy if you keep a summary page for reference (# of invoices in run, total balances, etc.).
If you just don't want a floating footer, you can select "print at bottom of page" for any section. This is handy for group totals. That, with "Repeat Group Header on Each Page", you can get some very nice looking invoices.
to fix height of detail section ..suppose i want size of 8 rows/records then
right click on detail section ->section expert ->on paging tab-> check on New page before beside button (x+2) write formula below given..
IF Remainder (RecordNumber, 8) = 0 THEN
TRUE
ELSE
FALSE
I know this question is really stale, but here's how to do what the OP asked.
You need to do 2 things. Find out the amount of real estate you need on the page for the 10 rows, and create a group footer that is that size directly beneath the detail line (e.g 2" or 5 cm).
Then, go into the section expert for the detail line and check the Underlay Following Sections box.
If you are ever going to have more than 10 detail lines, you also need to go to New Page after on the Paging tab and put in 10.
Put all fields Top = 0
Decrease section height.
Now, you have to set fields top dynamically.
Like this:
cr.Section1.ReportObjects.Item("Line1").Top = 0
cr.Section1.ReportObjects.Item("Line2").Top = cr.Section1.ReportObjects.Item("Line1").Top + cr.Section1.ReportObjects.Item("Line1").Height