category wise report in single page - crystal-reports

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.

Related

how to create a crystal Report with condition

I have a table like this image.
I want to create report from that table with condition.
I want to sum if Purpose Column is Banana then sum LoanAmount. Example: On the table There are 2 records of Purpose= "Banana" So LoanAmount will be 120000 for Banana. I also want to sum LoanAmount if LoanStatus="UC" and so on. How can i create that report?
One option is to simply insert a CrossTab in the report header or footer. Set rows to 'Purpose' and value to sum as 'Loan Amount'.
Another option is to create 3 formulas. The one for 'Banana' would look like:
IF {Purpose} = "Banana" Then {LoadAmount} ELSE 0
Then SUM those formulas to get the totals.
You can also use a Running Total with an evaluation condition but the approaches above are better.

how to count row in crystal report

I've got data as picture below, i'm using crystal report to display statistic report from that data.
i want to count MRN which got 2 until 5 rows of episode number only.
currently im doing
1) group MRN in crystal report and count(episode number).
2) create 1 formula like :
if count(episode number) >=2 and count(episode number)<=5 then count(episode number)"
3) put the formula to report and try to insert summary to count that formula, but no selection summary appear for that formula.
Can you give me an idea how to count MRN with 2 until 5 episode only? refer to picture for clear explanation
In Crystal you can use two condition types to sort which records are being showed:
Record selection formula
Group selection formula
Both are located in the menu Report > Selection formulas
In your case you can define a group on field MRN and create a Count field inside that group. To show only groups where the count is between 2 and 5, use the Selection Formula > Group condition in the Report menu.
Count ({EpisodeNo},{MRN}) <=5 and Count ({EpisodeNo},{MRN})>=2

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.

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.

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.