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

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.

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

How do i select records of crystal subreports dynamically

Good people of stack overflow.
I am stuck on this one.my crystal report is using a joined query
str = "SELECT invoices.voucher,
invoices.customer_name,invoice_details.item_name,
invoice_details.Amount FROM invoices
LEFT OUTER JOIN invoice_details
ON invoices.voucher =invoice_details.voucher "
The crystal report is grouped by voucher and the details are placed on detail section of group details to display item name and item amount.
It is working perfectly in design.
However at run time in VBNET when i select exactly the same query i get repeating line items. Example if the invoice items in invoice_details table were three in my report the three items will be repeated three times.
I have checked all over the internet for the same complain. No luck.
Someone suggested "suppress if duplicate" on an item with unique number such as voucher number. I did not get success.
Has someone met this difficulty and can you suggest how to resolve this?
If it can be of help to someone else...
My difficulty in duplicating line items was coming from using two tables, invoices and invoice_details when designing the crystal report.
And then using the link feature at crystal report design.
I had not realized i ought to have designed crystal report using a stored view (access query from the database). While using the stored view i did not do any linking at designing report but used grouping expert to group by invoice numbers.
So the report finally worked well after much frustration.

How to use Details band to display multiple data sets

I have a JasperReports's report with 10 rows fetched from the main query..
When i run the report it will show 10 rows without a problem.
Now when i add another band with fields of a data set in a list item. It is repeated for every record in the main report!. :(
How can i avoid this situation and change the second details band to print when the main report data has finished printing on the first band?
I would want to achieve this without going for sub-reports as it's difficult to maintain many files for a single report.
I have learned a lot on jasper reports over time and I'm posting the answer for my very own question to help someone in future.
What you need to do is for complex, Multi-query reports you create the main report with a simple query like this.
SELECT SYSDATE FROM DUAL
What this means is that when it's run main report details band will have a single iteration. That means if we have used the SYSDATE field in the details band it will print once.
OK, now if you follow the following steps you should be able to achieve the above task successfully.
Add two details band to the report (you must be having one details band by default, to add another right click --> add another detail band)
Add two data-sets to the main report (right click on the report and select Add Dataset)
Now all you need to do is use those two data sets in the previously created details bands by using either a list item or table item (personally I would recommend table as you can do lot of advanced stuff in that)
Hope this will help someone in the future. let me know if you need more help!. Cheers!!

SSRS report with multi-column content and fixed dimensions

I need to design a report that has some very specific requirements that I am having problems with.
The report needs to have fixed margins at the top and bottom (to allow for pre-printed content on paper). In the body of the report, there needs to be two seperate columns of data (student information). Below this, there needs to be a section that will contain information that will wrap to a new column depending on its length (student course and grade information). In addition, the course/grade information cannot break up a given academic year. Finally, there needs to be messages indicating "(End of Column)" and "(End of Transcript)."
Also, due to the nature of the data, I currently have the different sections of the report broken into sub-reports.
What would be the best way to design this report?
You can use a Tablix to allow your data to be displayed in two columns.
For the rows in the tablix you can leave "CanGrow" as "true" to ensure that it wraps and you will need to set grouping on your datasource based upon year.
You may need to set up a new field in your database that is set to only the year, then you can create a group on that field in your report. If this is SQL Server, you can add the following to the end of the "SELECT" statement before the "FROM" statememt
,DATEPART(YEAR,DateField) AS Year
For "End of column" and "End of Transcript" you will use grouping. You can set group headers and footers to display messages as required.
tutorial on setting up groups:
http://database.blogs.webucator.com/2010/09/10/add-format-and-grouping-to-a-report-in-sql-server-reporting-services-2008/
Update in response to op comments:
In addition, you can use expressions in to group on for data, so you can probably group with the following expression:
=FORMAT(Parameters!YearField.Value,"yyyy")

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.