Hold column group together in crosstab - jasper-reports

I created a report in iReport with a crosstab containing 2 ColumnGroups.
If the crosstab contains more columns than fitting on the page, they are (correctly) continued on the next page. But how can I prevent JR from splitting inside a column group (so if the next column group doesn´t fit on the page, start it on the next page).
Example of colGroups i my crosstab:
Category 1 Category 2 Category 3
C1 C2 C3 C1 C2 C3 C1
Category 3
C2 C3

hope this will useful; inside jasper report on crosstab option there's a checkbox called "keeptogether"; this chekbox keep table on the same page without splitting it

Related

Conditional Printing for Front and Back page

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.

Sum Left Outer Join In Subreport

I am working in a sub report. Visual Studio 2010 if relevant.
My first table has a unique record for every row in the details section. I am then attempting to use a Left Outer Join to join a second table to the first but then sum those values where there may be more than one row in table two per table one.
Right now I am having a problem with row duplication and the values from table two will not sum and instead print out individually. I have tried using groups and tried using Sum formula fields without success.
My first table is unique on a Record Number, Component and Sequence.
My second table also has those three items but may contain no record per the first table, one or multiple.
The Record Number and Component are passed to the report as parameters and are used in select expert. So really Sequence is only a unique record in my first table.
I have tried Group By Record Number, Component and Sequence for Table one. I have also tried Grouping by Sequence for Both Tables. I have tried adding a sum formula and even tried a running total without success.
Is this something that is possible? Is there something I may have missed trying?
Edit:
What I am current getting
Seq T1 Data T2 Data
10 A1 35
20 C2 25
20 C2 15
30 D5 30
40 D6 10
40 D6 50
What I am looking for
Seq T1 Data T2 Data
10 A1 35
20 C2 40
30 D5 30
40 D6 60
I finally figured it out. I grouped by Table 1 Sequence, then Table 2 Sequence (not sure if grouping by both is necessary). Then I used a Running Total Field in Group Footer right after the details section (Group for Table 2) and set the Reset value to On change of group 1 (Table 1).

Crystal Reports: How to pass parameter values between subreports?

I've been working on a report that makes use of three subreports (A,B and C). The idea here is to locate the subreports side by side, where each one has its own list, but also this:
-A is located on the left (with columns c1, c2 and c3 where c1 is like customerID)
-B is located right after A and has columns (c1, c4 and c6) which should present data corresponding to the records of A according to the same value of c1 (customerID)
-C is located right after B, has the columns (c1, c7 and c8) and the same applies to it as in B.
I want it to look like one single table where c1 should only be visible once.
I also know there is the linking option but it doesn't seem to be working. If that's what you're gonna say, how can I configure the links? If not, how can I do this?
And no, there is no way this could be done in one single report.
To the extent I understand you want to pass the c1 value across 3 subreports. In this case link the subreports to main reports and pass the c1 value to the report selection formula of the sub reports so that all reports retrive only c1 value
Now in sub reports B and C .. don't keep C1 column just keep c1 column in sub report A.
But let me know any specific reason to use sub reports instead you can place coulms from c1 to 17 side by side in a main report

iReport presenting data horizontally back

Using iReports, is there a way to display the data where it's going back and forth and pulling the data from one SQL statement?
Where an SQL query returned the following records
a0
a1
a2
a3
a4
a5
The report would be filled as follows ...
a0 a1
a2 a3
a4 a5
Normally I wouldn't have a problem doing a table, but I have to replicate someone's "application."
Yes, iReports allows you to fill your report so that the data is presented horizontally as you require in your question.
You can also specify how many columns you present in your report.
In the Report Inspector, right click on the report and select
Properties
In the Properties Dialog,
Click on the number beside Columns, enter 2.
Click on Print Order, select Horizontal
Click on Close
Press CTRL ALT PgDn to preview your report

Hide a column in cross-tab depending on the value of parameter (Crystal Reports XI)

I'm using Crystal Reports XI (R2) and have a cross-tab which displays information about flights. There is the 'Total' column' as well as the Arrivals and Departures columns which are created automatically thanks to the grouping condition. What I'm trying to do is to have the 'flight directions' parameter, where the user can select 'All, departures only or arrivals only' values and according to this selection the cross-tab would have one or two columns. How can this be achieved? I tried using the following formula(and have the suppress empty columns option enabled) :
if {?Pm-#flight_direction_description} = "Departures Only"
then
if ({Command_1.IsArrival} = 1)
then 0
else {Command_1.IsArrival}
which indeed works (only one column is displayed) but then under the Departures column it lists all the flights (so the departures column is the same as the Total column) whereas it should only display information about departing flights.
I've had similar situations come up; while certainly not ideal, and if no one has any better suggestions, you could create Detail A, Detail B and Detail C sections, all of them suppressed. From there...
You could put your "All" crosstab in Detail A
Create a second crosstab for Destinations only, and put that in Detail B
Create a third crosstab for Arrivals only, and put that in Detail C
Then, in your Detail A, B and C sections, you can condtionally unsuppress the section you want based on the parameter passed in.