Crystal Reports Crosstab Suppress subtotals when there is one row - crystal-reports

I am using a crosstab in crystal reports that has 3 grouping levels this can create a lot of subtotals across the rows. Often the subtotal row is useless if there is only one row it is summing from. Is it possible to supress subtotals where there is only one row of data? Leaving the useful subtotals (I know I can suppress the lot).
Illustration below this is how I currently have it:
This is how I would like it to be:
Notice the sub totals for the Middle Grouping B and T have been removed leaving just C as it has two distinct rows below it. To me that looks much cleared and I would be surprised if this can't be achieved.

I recommend skipping the Crystal Crosstab and making your own:
Make a subreport where you want the crosstab to appear (you may not need a subreport, but I'll assume you do).
Group the subreport by your 3 levels.
Drag & drop your fields onto your design however you want them.
In the group footer sections, add some custom field formulas with the sum({number},{group}) for the custom formula.
Using the section expert, suppress the fields as you see fit. The count({number},{group}) would be useful here.
It'll take a fair bit of tweaking to get it right, and of course the columns in your manual crosstab will be fixed, but this allows for the most customization.

Related

Report vertical layout

I have existing report w/ "groups" for Total/Directs/Warehouse/Credits that span horizontally. I need to now stack these groupings vertically. What is the best way to do this in CR? I am used to SSRS, Excel, PowerBI, etc. Crystal Reports is much less intuitive than those tools.
Do I need some kind of funky nested groups? Sub reports? How should we approach this? We assumed it would be a pretty simple formatting/layout change. But it looks like it's actually quite complex to do this.
Original:
How it needs to be re-worked:
If the entire table you're showing is in a Footer, you can just add 3 new footer sections and duplicate the table in each (removing any columns you don't need.) Just right click the relevant section and Insert Section Below.
Otherwise you'll need to use subreports. But since you have the columns already configured, all you really have to do is:
Save 4 subreports, Total, Directs, Warehouse, and Credits. (Just save a copy of your existing report, and delete everything that doesn't need to show up in Total. Rinse and repeat.)
Import each and add the parameters as subreport links
Give them each their own section

Crystal report Cross-Tab order by another column

I've made a crosstab in crystal report like below:
However, as you can see, the ordering is weirld (i.e. the correct one should be like below:)
And the ordering is stored in another field called order, I took a look in the crystal report's cross-tab expert sorting option, it doesn't allow me to order by another column, it only allows me to sort either ascending or descending, how can I set the ordering by another column?
Crosstab's sorting is based on the rows order, if you want to sort it in your on you have to add some extra rows and have to suppress subtotal and Label in Customize Style of Crosstab Expert
Example:
If you have 3 rows(A,B,C) to display and you have to sort it in order like B,C,A then you have to add 2 new rows(B,C) now your Crosstab looks like (B,C,A,B,C) now you have to suppress Rows B and C you meet your both requirements for sorting and display order
But This solution have some limitations like
if you want to export the report in Excel then it will add extra cells in grand total.
otherwise you are good to go.
Example:
If you have 3 rows(A,B,C) to display and you added one row and you suppress it to solve your sorting issue then in Excel its grand total looks like
A B C
a 1 3
b 2 2
---------------------------
Total: 3 5
Yes, you can not sort on another column. You must use any of one column as a header.
In Crystal report, sorting happened based on header column's value (That's why you see as per alphabetic).
I also face this issue and how I solved, that I am explain. You have to use a formula which have order, but either hide it or use a value like in this link.
https://scn.sap.com/thread/3341846
Second option as per this link. (I think first you check this)
http://www.codeproject.com/Tips/493334/Custom-sorting-for-Crystal-Report-Cross-Tab
https://scn.sap.com/thread/1172741
open crosstab expert, highlight the column that you want to reorder, go to Group Options and select in specified order. This will open another tab where you will have your available values listed there. Using the arrows on the right side you can move up or down your values and accommodate them in the order you want them to be displayed.
Simple way would be take order column from stored procedure to cross tab and set the order according to that column.
Then supress the order column and reduce the width of that column to minimum pixel so that it doesn't appear in cross tab.
Make the field you want to sort by a group field and hide it. To hide it, in the Crosstab Expert > Customize Style dialog select this group then use the Group Options area to Suppress Subtotal and Supress Label. Worked for me.
Use the order field as the grouping column and change the label for said column to show the actual sizes. The labels can be changed in Crosstab Expert, Grouping Options and then the tab Options.

Jasper Report group subreports using columns

I have a master report (using iReport 5.0.4) with a subreport that uses grouping by a field called "Group Number" (sorry, but that is the actual column name).
My report works fine when there are more than one group, but it generates each group result scrolling down the page vertically.
I would like to be able to have each group go across vertically, but when I tried using columns, it simply forces each group's data into columns, and not the entire group 1, followed by group 2 in the next column, etc.
There can be up to 8 groups, so I was hoping not to have to create 8 individual sub-subreports with a "print when" expression to show/hide them.
Can anyone tell me if this should be possible?
Thanks,
Mitch
I think making subreports is the easiest and obvious way. But if you want to make it in other way, I can only suggest to use scriptlet, and form dataset manually (Transpose it).
Another suggestion is when you generating report directly from database (i.e. passing connection into jasper) you can modify query and transpose the data (PIVOT table).
Anyway provide more info about your case. I will try to help you.

In Crystal Reports, can I combine the detail lines of the main report with the detail lines of a subreport?

This is a resource planning report, and the goal is to have a running total of usage and purchases for each component. Currently, I have the main report details section that lists usage amounts ordered by date for a part. In the group footer, I have a subreport that lists all of the purchase orders for the part. I want the detail lines of the purchases subreport to be included among the detail lines of the main report at the appropriate date, kind of like a list of credits and debits. Then, for each line, the running total will subtract usage amounts and add purchase amounts. I put the subreport in the main report details section, but then it is run for each line. So I tried to suppress duplicates, but it doesn't land in the correct date position. I tried various other things like splitting the detail section of the main report and changing the linked fields of the reports to no avail.
Thanks!
Let me get this straight. You have a table of "credits" and another table of "debits" and you want them both to appear in an orderly manner in the details section. You tried a few different methods (those were all good attempts, by the way), but didn't get what you liked.
I recommend looking at your data source and seeing if you can union the two datasets there. In other words, don't bother with doing all that in Crystal.

How can I hide an empty second in crystal reports?

I have several groupings in my report, and based on a formula, sometimes there are no rows displayed for the parent grouping. How can I hide the parent grouping if there are no rows displayed? I have SupressIfBlank set to true but that doesn't seem to do anything.
I'm a little rusty, so bear with me....
In the section properties for the group totals, there's a setting for "Suppress", and one of the options is a button that lets you write a formula (in the most recent version I used, this was blue if blank & red if there's a formula written). Click this, it'll take you to the Formula Editor. Write something that counts the rows and returns a Boolean: True for zero rows, False for non-zero.
According to this similar question I found on the Internet, it doesn't seem like CR has this functionality built in. The options presented there are as follows:
Restructure the report's queries so that group headers aren't returned if the detail records are missing. As in you push the formulas down into the queries themselves so that the headers are never returned.
Count the number of detail records on a per-header basis. So you make a formula for the header's suppress field, and suppress it if the detail count is 0.
Either of those should work with the majority of reports. Don't know the specifics of how to implement them, though.