Multiple cross tabs in single jasperreports and grouping them - jasper-reports

Can anyone please tell me how to group crosstabs w.r.t report level group. i.e. in my problem i am using three crosstabs in details band.....and i want this page to be grouped by coutryname. eg.if country=Australia print three crosstabs and if country changes to india print three crosstab on the next page

Use a subdataset for your Crosstab, which take the country as parameter.
In the main report, call for a list of the country you want to display. This will produce one detail band for each country (ex: $F{Country})
In the detail band use the value of the country field ($F{Country}) as parameter for the subdataset you use in your cross tab.

Related

Merge data inside group Crystal Reports

I have a Crystal Report setup in my WPF Application. The report is grouping data based on VENDOR NAME field as shown in attached image. Now what i want is to show data inside a group only once.
I mean as in first group TOYOTA HOUSE the Vendor name is repeating although other column values are different. i want is under this group just show this record once and for other columns ADD/sum their values and show. I know i can do that in SQL query but can i do this in crystal report ?
Instead of showing in the details section add it to the group footer section.
suppress details section
and add totals in group footer

crystal report - repeat group header across multiple column

I have a report that has 3 columns and it is grouped by a value that i display in the group header. The report is setup to run down then across.
If the details span across multiple columns, how do I repeat that group header on the next column.
I have already checked "repeat group header on each page" in the group expert.
I have already checked "format groups with multiple column" in the Layout tab of the details section.
It will not let me insert a text object in the group header of each column.
Not sure how to do this. I could write a formula to only show at the top of each column, but not sure if there is a function to find out when the second column has started.
edit
What i want is below
Group Header Text Group Header Text Group Header Text
Detail Values Detail Values Detail Values
Detail Values Detail Values Detail Values
I would like to have the Group Header Text show at the top of each column. Doesn't matter if its the start of a new group or in the middle of the group.
thanks.
okay, I have your solution, the field, that you are grouping by , just place it on to the page header and it will repeat itself on every page until the columns of that group are finished.
Lets say you are grouping by Employee Names, just put the Employee Name field on to the page header and it should solve the issue, I jsut tried it and it worked, thanks.
There is Previous() function available in formulas that allows to show-hide a Text Object based on the change of specific field value from previous to current record.
Is this what are you looking for? Can you edit you question drawing a sample af what you have and what you want?

Multiple detail band in JasperReports

I want to show multiple detail section in my jasper report. How to add multiple detail bands in JasperReports? For details band I am passing collection from my java class. So if I have multiple detail band how to pass the different collections to different detail band.
Can some one provide help on this
it's seems that this question was asked long time in past. Now with new JasperReports version, multiple detail bands are possible. Please refer to JasperReports download for latest revision.
You should use subreports.
Multiple "Detail" bands is not possible. You can add "Group Bands" before and after the Detail band though.
UPDATE
For the upper part of the report:
The Detail Band is the one with the Product Line, Name, Amount ... etc.
The Group surrounding the Detail, containing the Branch is one level upper group.
The Group surrounding the Branch Group is the State Bang, its the top level.
First make two groups, call one of them "State" and the other "Branch", When writing your query make sure you order the results by State, then Branch. If you do that, Jasper will make sure to group the results exactly as in the snapshot.
Check this snapshot, you should make the report something like this:

Merge rows of same values in jasper Repors Detail Band

My data contains same value for a particular column.
My requirement is to merge the data rows for that particular column alone in detail band.
Is it possible in jasper reports.
please help.
Thanks & Regards,
Prasanna
You can make another group, other than Detail and set the Group Expression to the same field you want.
For example, if I want to group on Country, and show Cities in each country. In "Country" Group Expression. I would write:
$F{countryField}

Flatten data inside a crystal report

Ok, this might be a weird request, but is it possible to essentially flatten my dataset inside a crystal report?
I have a datatable in C# that was created with a join, so when it hits the report its 2 records. Most of the columns have identical data, with the last few displaying a different address.
Instead of printing the detail section multiple times with mostly similar data, I need to display 1 'record' with the common data printed once, and each records address arranged next it. As in, all the common fields displayed in one area, and then next to that the address fields from the record where 'AddressType = 1', then next to that the address fields where 'AddressType = 2'
Is this a subreport thing? Because even with subreports I can't get it to only print 1 detail section with the data from just the first record.
Is this even possible with crystal? For long drawn out reasons, I can't flatten the data before it gets to the report.
Ok, someone here in the office showed me the way, so I'll put this out there.
Given data with cols A,B,C all common and D,E different across multiple rows, this is how I 'flattened' the dataset in crystal:
Create a group based on col A, and put A,B,C inside that group header - get rid of the details section entirely
Create a subreport in the group header for each row of data, in my case 2 subreports
Inside each subreport, put fields D,E. Important: There are NO links for these subreports!
For each subreport go into the Select Expert and create a condition that shows only 1 particular row of data. This conditional will have the same field for each subreport, but different values. In my case it was AddressType='A', and AddressType='B'
This will produce 1 report, with A,B,C listed once, and D,E listed once for each subreport(once for each row of data)
This was confusing, time consuming, and I hate crystal reports now more than ever.
It would be pretty ugly, but you could add a group for each common field in Group Expert and then display the data for the common fields in the last group header. So if your common fields are field1 through field5, you would create five groups and put all five fields in the group header of field5. Then you would put the unique address fields (call them field field6 through field8) in the details section.
Now the trick is getting everything to line up correctly. You can set "underlay following sections" on the group header for field5; this will cause field1 through field5 to "fall down" into the details section. You just need to make sure that field6 through field8 are all to the right of field1 through field5 so the text does not overlap.
Now, if you want the two address records to print horizontally, I think you will need a subreport with multiple columns for that. But the same principle applies -- just make sure the subreport is to the right of field1 through field5 so the data doesn't overlap.
Have you tried the suppress if duplicated option on each non-address field?
Otherwise, you could group by the common id, put the common fields in that header, and then display the multiple addresses in the details section.
Or, you could remove the addresses from the datasource and use a subreport to fetch this data for each record. This would bypass the join and be the slowest option performance wise, due to having to select the addresses for each record.
Ok, firstly let's see if I understand this right :
You want a report that would be in the format
MainDetails Address(type1)
MainDetails Address(type2)
to instead be in the format
MainDetails Address(type1) Address(type2)
?
Assuming there are only two address types, you can do the following :
1) Group by Main details (whatever the unique entry is
2) Put the address details in the group header next to them, on the right
3) Also put the address details in the details section, but positioned as if they were in the Address(type2) column positions, so it looks like :
GH MainDetails Address
D.......................................Address
4) Next, add a sort to the report on the AddressType field, so that AddressType=1 shows first.
5) Add a conditional suppression formula to the Details section saying {AddressType=1}
6) Using the Section Expert, in the Group Header tick the 'underlay following sections' box
This should work as long as the number of addresses is either 1 or 2.