Multiple groups in Crystal Reports - crystal-reports

How can I use multiple groups — which are not nested — in Crystal Reports?
A little Example of what I want to do:
-hire car header
--rentals header (group)
---rental from 01-02-2008 to 01-06-2008
---rental from 01-08-2008 to 01-09-2008
---rental from 01-12-2008 to 01-15-2008
--rentals footer
--repairs header (group)
---repair from 02-02-2008 to 02-05-2009
--repairs footer
-hire car footer
hire car is the normal report, and rentals and repairs are the groups. The groups are not nested. My current problem is that I can't really create something like that, and I can't change the structure to solve this problem...
I'm totally new to crystal reports.

That's a good question. I would call that a double one-to-many. You have "hire car" which can have many rentals and/or many repairs.
One solution would be to use two sub-reports for the rentals and repairs.
Another solution would be to union together the repairs and rentals. Then have crystal group on the column that specifies if the row is rental or repair data. You would also have to show/suppress the correct labels, fields, etc. This get's very clunky so your best bet is to go the sub-report route.

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

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.

crystal reports total of values field

I'm using Crystal Reports 10 right now and I have my report almost finished. I have a group of customers and for each customer, I have multiple lines of customer information. The one thing I'm still trying to figure out though is how can I get a running total of one column's distinct values.
So, for example I have a customer Bob who has 6 different items. For each item, there is a manufacturer. It might be the same for all 6 items, it might be one for 3 of them and another for the other 3, or they might all be different. What I want is to have a field at the bottom of the group for Bob that would say:
Man1 - 3
Man2 - 1
Man3 - 2
with the manufacturer being on the left side and the number of items they make for that customer on the right side.
Is there anything in Crystal Reports that can do this right now? Or can someone give me some advice on where I would get started on a formula to do this? Thanks for any help you guys can give.
Need more information:
What kind of data structure are we talking about? How are the manufacturer and item data found? How are these related to the customer? How many manufacturers/items are typically found per customer?
If the manufacturer and items are two different fields, that might be simple (cross tab in customer group). If they are free form, that might be a problem. If there are separate fields for every manufacturer (I've see it happen), then that might be a problem.
Best scenario:
One field for manufacturer, one field for item, distinct relation to customer.
Possible solution:
Group by customer, sub-group by manufacturer, count of items.
Not best scenario:
Table for customer, separate table for each manufacturer.
Possible solution:
Main report, group by customer. Linked subreport on Manufacturer/items.
Worst scenario:
Free-text entry of manufacturer and items in a memo field.
Possible solution:
Redesign your database (grin).
If you have to, you can do this using logic tests through formulas, but if you have many manufacturers/items, it would get exhaustive.
Best answer: More information.

Crystal Reports Crosstab Suppress subtotals when there is one row

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.

Displaying a Tree Structure in Crystal Reports

Does anyone know of a way to represent a tree structure in Crystal Reports?
My big issue is that I don't know the depth of the tree. It is represented in a database table with a simple "childId -> parentId" relationship.
A perfect example would be to open Windows Explorer, and look at the directory tree on the left side. If anyone knows a way to represent that tree, then it'll work for what I need to do too.
My initial attempts have been:
1) to programatically (in C#) add Groups to the report. Unfortunately, you can't create a new instance of the Group class and add it to the Groups collection.
2) recursively nest the same report into itself for each level. In other words:
mainReport
subReport
subReport
subReport
subReport
subReport
subReport
etc...
Unfortunately, SubReports can't contain SubReports.
I really don't want to just add X number of groups into a report and hide the ones I don't need, because I'd have to add a fixed number of nested groups, but technically the data design can support an infinite depth, even though in practice we see up to about 5 levels of depth.
So, any other ideas?
Crystal XI added hierarchical grouping. You'll find this under the Reports menu. I put together a quick org chart report with n-level depth using this. The database table is like:
id
name
managerId
In the Crystal Report, you select these columns, group by id. Then under "Hierarchical Grouping options" menu under Reports, check off "Group Data Hierarchically", parent Id managerId, and indent appropriately.
The output is like the tree you described in Explorer.