Fix the size of details section in crystal report - crystal-reports

I m using crystal report in vs2010.
I m generating Tax invoice report..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

Try changing the print at bottom of page property in the select expert. That should do the trick.

1)First of all fix height of detail section by right click on detail section ->section expert->New Page Before checked->beside button of (x+2) write formula(Suppose you want 7 records in per page and further on another page -> IF Remainder (RecordNumber, 8) = 0 THEN TRUE ELSE FALSE
2)under detail section (suppose section3) is your detail section then leave report section blank with needed space and else for footer put it in page footer .. i think this will solve your problem.. mine is solved..

In my case in the New Page Before checked add:
IF Remainder (RecordNumber, 18) = 0 THEN TRUE ELSE FALSE

Related

Fix Page Header Height in Crystal reports

Is it possible to fix the height of page header or any other solutions?
My problem is I need to do this list of persons in page header
Boy Janna
Girl Leo
Ana Erick
Mina Carlo
Lea Shena
But it must be like this
(for page 1)
Boy Janna
Girl Leo
Ana Erick
(next page)
Mina Carlo
Lea Shena
If number of person is 6 or lower it will only appear in first page (if two page report the second page must have blank person). If the number of person is more than 6 the number 7 person and up will appear to next pages and so on.
The maximum row is 3 per page
This Sub report is in Page header in main report
I put this code in supress of Sub Report for Persons. If I don't tick the Can Grow and adjust the text box (it only shows 6 names) and other names are now missing and not appearing in the next page. If I tick can grow and remove the below supression code what happens is it shows repeated name each page.
if PageNumber = 1 then
false
else if PageNumber = TotalPageCount then
true
else
true
Thanks in advance
yes you can do it in group header or footer and the process you followed won't give you correct results. Follow below process.
In grouper header or footer take a sub report and place only those fields in the sub report that you want to display.
In sub report place the field in detail section and then go to
Right click Details --> section expert --> paging --> tick the check box visible records
In the space provided input number of records you want to view per page and no go to preview.
You can see those many records per page in group.
This is working solution I tried group header and group footer of a group.
Let me know if you face any issue.

Different content in odd and even pages

I'm using Jasper iReports 5.2.0 and I want to print a list on odd pages of the report and a static text on the even pages.
To achieve this I created a report with my query of a list with 100 sequential rows and put it in the Detail 1 and my static text in Detail 2.
Then I added:
Print When Expression = $V{PAGE_NUMBER}%2 != 0 to Column Header and Detail 1
and Print When Expression = $V{PAGE_NUMBER}%2 != 0 to Detail 2
and also maximized Detail 2 Band Height (without this I will loose more rows)
Everything show in the right pages but report aren't showing all rows.
I mean, if my query return 100 rows, 1-100
1st page show 1-20
2nd page show static text
3rd page show 22-40
4th page show static text
5th page show 42-60
...
What should I do so that row be printed in the right page?
You should do the following:
Create 2 Detail Bands:
a) Detail1 - For static even pages (!make sure this detail band is first). Maximize it's size - to use whole page, put your static text on it. Set PrintWhenExpression = $V{PAGE_NUMBER}%2 == 0 on band
b) Detail2 - For your data, do not use any PrintWhenExpressions on it
How it works: wholepage DetailBand1 is shown only on even pages, because it takes whole page, your data detail band (Detail2) is moved to even page, so everything works as expected, and no records are missed.

How to Suppress Header

I am working with Crystal Report, I have data which is grouped. Below I am attaching the designer view of the report.
The issue is: my header repeats on every page, if my Sub report goes to second or third page, or as long as it grows..
How should I suppress my header if the detail portion of the report only occupying the first page ..?
try like this:
in page header ``supress`
if pagenumber=1
then true
else false
In your group expert >> Click on "Options">> Select "Options" tab >> uncheck repeat group header on each page.

Jasper Reports subreport on a new page

I have a jasper report that consists of 6 subreports. Each of these subreports has its own title section. Now I need each report to start on the new page. I tried adding page breaks but it did not work for me.
While researching the problem I cam across a trick to set isTitleNewPage to true at
http://www.dzone.com/snippets/jasperreports-subreport-new. So I added the attribute isTitleNewPage="true" to all the subreports, but now the subreport's Title remains on the previous page and Details and Summary of that subreport are being displayed on a new page.
How can i solve this problem??
Simplest solution is to set runToBottom flag to true in subreport tags.
<subreport runToBottom="true">
This forces the subreport to fill the whole page, so the next subreport will start on a new page.
Flag isTitleNewPage won't do the trick because like you noticed, it will split the subreport's title band with the rest of the subreport content (unless you're using a blank title band).
In the initial tag:
<jasperReport
put:
isTitleNewPage="true"
I had the same problem that the title remains on the previous page.
But I have a solution:
put the stuff from the title in the "page header" band
set isTitleNewPage="true"
add a Integer variable to the subreport with the initial value 0
inkrement type "page"
expression $V{vari} + 1
print when expression of the page header is $V{vari} == 0
Now u have your title stuff on a new page, but only one time.
My solution to this problem is to add every Subreport in a separate "Detail band" and then set the Band height to the biggest possible value (right click on the "Detail X Band" => "Maximize Band Height"). Between bands could be printed some blank pages, but that is not a big problem in my case.
I solved it by add page break at the start of the sub report in the top side, no use "Print when expression" or anything else
Report formation:
Master Report -> 1st page -> 2nd page -> Sub report -> (add page break on top) title+ 2 sub report -> master report end page
Add a detail band for each sub report and go to the sub report properties and put a tick on Title on a new page.
I solved it by putting a page break at the beggining of each subreport, just before the title label and set 'new Boolean (true)' on the 'Print When Expression' property for each page break.

How to remove blank page in jasper report when using page break

I need add page break in sub report A, so that sub report B will start in a new page. And rows in sub report A is not determined. So, sometimes there is a blank page between sub report A and sub report B.
Question is - how to avoid the unwanted blank page? I know there is a 'print when' property for page break, but I can NOT figure out the proper condition.
Could you please give me some help?
You should place the page break exactly at the bottom of the band.
Example : If the "Detail 1" band is 100 height : Page Break (on Detail 1) top is 99 and Page Break Height is 1.
May be, "When No Data - No pages" property may solve your problem.