Conditional Printing for Front and Back page - jasper-reports

I'm using iReport 5.2.0 and I have 2 reports that I want to print.
Both reports contain dynamic data and can be of multiple pages. However, number of pages of first report is always equal to number of pages in second report.
In my current setup, the first report is always printed completely and then all the pages of the second report are printed.
However, my requirement is that the report should print in the following sequence:
Page 1 of Report 1.
Page 1 of Report 2.
Page 2 of Report 1.
Page 2 of Report 2.
Page 3 of Report 1.
Page 3 of Report 2.
...
Is there any way I could achieve this with JasperReports?

Lets say , report 1 uses X query with X_SQL and report 2 uses Y query with Y_SQL.
If both of the query has same number of column then it is great otherwise add additional column with respect to X_SQL and Y_SQL in order to union both query.
Remember you have to generate one number series column and one dummy column in your sql. You can generate number series dynamically in your sql.
X_SQL with two new column (number_series,'detail1'as dummy)
union
Y_SQL with two new column (number_series,'detail2'as dummy)
order by number_series, dummy
OUTPUT of SQL:
X_SQL column , 1 as number_series, 'detail1' as dummy
Y_SQL column , 1 as number_series, 'detail2' as dummy
X_SQL column , 2 as number_series, 'detail1' as dummy
Y_SQL column , 2 as number_series, 'detail2' as dummy
Now add two detail band in your new report. Height of report is only one detail band height + top and bottom padding.
1 detail band = first report design
2 detail band = second report design
U can use subreport if your jrxml is too complex.
Now in print when expression of detail band use
detail band 1 : $F{dummy}.equals('detail1')
detail band 2 : $F{dummy}.equals('detail2')
Note:
1) you need to order by in your sql query.
2) height of report need to choose properly.
If still you are having issue then i suggest to post your jrxml.

Related

category wise report in single page

I have a table like below image
I wank to create a report like following image
I have created three formula field for filter Banana, Potato and Corn. Formula code is here:
if {Table1.Purpose}='Banana' then
{Table1.LoanAmount}
else
0
if {Table1.Purpose}='Potato' then
{Table1.LoanAmount}
else
0
if {Table1.Purpose}='Corn' then
{Table1.LoanAmount}
else
0
I also created three formula field to sum Banana, Potato, Corn. Formula name is SBanana, SPotato, SCorn
sum({#Banana}), sum({#Potato}), sum({#Corn})
And i insert it in my crystal report. But my report not show like this image. It shows four pages for four records. How can i create report like above image?
Insert 3 CrossTabs in the Report Footer a, b, and c, each with a different element controlling the row.
Another (more complex) option is to use subreports.

Crosstab two columns under one column header Crystal Report

I want to create a report like
in crystal report cross tab.
The Table has the following data .
I can get the report with three expected columns like SELF, 50% and 75%.
and their output look like
But my requirement is to use Increases and NPCalculated Columns under Main Column as mentioned in pic 1 above.
Note: I used the NPCalculated in Summarized Fields but It gives me out like NPCalculated Value comes under Increases Value but It should be side by side as per my requirement.
First I add NPCalculated column in Summarized field and now I have two summarized fields. Next, right-click one of the summary cells > Summarized Field lables > Summarize horizontally.

Details rows inside tablix SSRS Reporting service, Records with Details rows under it

Now it is a report with a tablix in which the records are like every row has some details rows under it. and the details row can have one or more records based on the main tablix rows
To elucidate the problem, plz have a look
Did some search here and there, but not able to figure out how to accomplish this.
Sub-reports inside the tablix cell, but how will it keep the track of the current row
One thing more : Do I need to create two separate datasets for this and bind accordingly or write query as a single dataset and do some grouping ?
any ideas !
P.S: SSRS r2 environment, native mode reports for web application
You can achieve this with one Dataset and one Tablix.
The Dataset will have all the columns in the report, with multiple rows for each BIL value.
The Tablix will have four rows and one group based on BIL.
The first row will be the Tablix header row, with the main column header details.
The next two rows will be group header rows. The first row will contain the group details, BIL, No Bayar, etc. The second row will contain the detail row header details.
The last row will be the detail row which will contain the COL1 and COL2 detail values.
You will see something like this (you'll need to fill in the TextBox details as appropriate):
create report with subreport will solve your problem
you can create one report with one dataset with (BIL NoB NoW Est TotalXYZ) columns.
Now link that subreport with the BIL
Now link subreport with main report the BIL (FK)
Hope this help

How do I get a 3 page report in Jaspersoft iReport Designer 4.7

First of all: I've read this question but it is not working for me.
What I need:
I have an SQL query that returns a 3 column set with about 50 rows that looks like this:
year | month | number
2012 | 1 | 35
2012 | 2 | 24
2012 | 3 | 127
and so on. Now I need two different representations of this data. The first one is a 2D bar chart and the second one a table with the numbers presented. I managed to do both, but what I'd like to have for the whole report is, to have 3 pages in total.
First page should be a simple cover page with the title of the report, which I can get by simply adding the title band, as far as I've understood. The second page should be the bar chart (filling the whole page) and the third page should be the table (also filling the whole page).
I've tried the following and didn't get the result I need:
Created 2 subreports (1 for bar, 1 for table), added them both in a main report (in the details band) with a page break in between. The result was 2 pages, but the chart and the table filled only half of their page. When I tried to resize the subreports to the full size of the page I got the error message that they're out of range...
Created 1 report with 2 detail bands. Added the chart into the detail band 1 and the table into the detail band 2. This worked for both elements to be the full size of the page, but the whole compiled report now has 100 pages --> 2 pages for one row in my sql set
So how can I accomplish what I need!? Is it even the right tool to use? Or should I simply create two reports, export them as PDFs and combine the PDFs by hand?
My suggestion - in your SQL query, add a fourth column that concatentates your year and month (let's call that year-month). Create a detail band with the following fields: year, month, number. Create a summary band for your chart with year-month as your x-axis and number as your y-axis. Make the title and summary bands the size of your output paper. In iReport, right-click on the name of your report and go to the Properties box for the report. Check the box for "Summary on a new page."

Addid Static Report Titile on Crystal Report

i have faced some problem , when i want to display some static Title after i have displayed a few number of Rows . for Example , the first 4 rouws on crystal Report has header"Training " the next 4 rows mmust have "Education " Report Header.
i am trying to display the report using by calling one Stored Procedures any one who can help me please??
You could insert a new detail section above your current detail section and have the new section only be visible based on record count or some value in the data. Add a new section in the details, Format Section->Suppress and enter a formula controlling when the new section is visible. For example, a running total field named InspIDCount and this formula in the suppress section ({#InspIDCount} mod 5 <> 0) will cause a blank row every 5 records. The new section could contain a formula to display the correct "title".
I think I misunderstood your question. The number of rows for each type is probably not constant. A better way to handle this would the to insert a group into your report if the data is not already grouped. Group by the record type (Education, Training Etc). You probably want to suppress the group header but show group by footer. The footer could display a field from the database showing the type or it could display a formula (string) based on the record type. It would only take a few minutes to give this a try.