Main report does not load if the subreport is blank - crystal-reports

I am working on a Crystal report and there is a subreprot for that. For some of the customer there is no data in the table sub report is using. So for those customer the main report comes as blank..
Is there a way to fix it ? Any help will be greatly appreciated.

1) Could possibly be a problem with your subreport links.
2) Or the JOINS in you main report. You must be using a INNER JOIN instead of a LEFT JOIN. Confirm that all the links are correct. If possible SQL profile the report when run and have a look at your query.

Related

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.

Crystal Report : Print multiple Bills on same page

I want to save customer's page (space) and I'm sure each bill will not have more than 4-5 records in detail section. I'm having exactly same issue posted on below URL, can anybody help me on this?
http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=14981
Note: I'm using crystal report for visual studio 2012.
The problem you will not solve easily since you will have the problem to enforce a fix height of this sections but having dynamic number of records. I guess you will need to work with fix-height detail bands in sub reports and you will need to ensure that all customers will have the same count of detail records. There fore, you may need to make a temporary print table that you use to insert empty-records.
You need to work with a sub report and you need to work with a multi-column layout (with two columns) in the main report.
The main report will only select the main record, not the detail records.
In the sub-report, you need to select the temporary detail table which ensures that all customers have the same detail record count and that the sub report will have the A6 height with that fix record count.
No good solution, but I guess any solution will require some temporary prepared data...

Subreport Inner-join showing different results than same Main report inner-join

Crystal Reports is used to create templates for another application in my case. A value is passed from the other application to a specific table, which I can then, in crystal, use with inner joins to other tables to specify the values on the rest of the report.
This has worked well in situations where I have not being using subreports. In my main report, I have 4 tables inner joined, and they are correctly being passed a certain value from this program.
My problem lies with attempting to create a coverpage for this particular report. I needed a detail section on the coverpage, so I looked to creating a subreport on the report header of the main report. I used the same tables in the subreport itself with the same inner joins. It receives extra values. This is the exact inner join design with the same tables from the main report, yet it is showing different results.
Does anyone have a solution to this? I am particularly new to crystal reports, and have just avoided subreports to avoid deeper complication. I believe I may just be able to pass the criteria value from the main report through a shared variable or parameter as an alternative to my current attempt, but I am not sure how.
Thanks.
It sounds like you are taking the right approach by using a subreport. You did add the parameter to the subreport and linked it through from the main report?
I suggest you view the SQL query for both the main report and subreport to identify the discrepancy.

Crystal Reports Data disappearing

I am currently designing a report in crystal reports.
In the header I have the standard fields like Date/Time and a bunch of variables. In some cases one of the variables does not resolve to anything (it is empty).
When that variable is empty all the report data disappears.
I tried tricking Crystal Reports with creating a formular field, but again no luck!
Any ideas?
All data is received from a MySQL database and the field that causes the trouble is based on a custom query (command).
The actual query:
SELECT `teacher_name`
FROM `class_schedule`
LEFT JOIN (`teacher`, `cs_class`)
ON (`class_schedule`.`class_supporter`=`teacher`.`teacher_id` AND
`cs_class`.`cs_id`=`class_schedule`.`cs_id`)
WHERE `class_id`={?classId}
I have not worked with MySQL much at all. That said, I have never seen that construct for LOJs, so I am questioning the format. Pardon my ignorance if I am uninformed.
If you have CR Developer available, it might be interesting to see what query CR comes up with, and I guess a trace will show what is actually submitted to MySQL.
SELECT `teacher_name`
FROM `class_schedule` cs
LEFT outer JOIN `teacher` tch
on `cs`.`class_supporter`=`tch`.`teacher_id`
Left outer join `cs_class` csc
on `csc`.`cs_id`=`cs`.`cs_id`
WHERE `class_id`={?classId}
is the best I can recommend trying.

Crystal reports 11: how do you debug a crystal report?

When I'm creating a crystal report and when I add fields and fields to a database, the report outputs a completely blank report for the invoice I am creating. How do you debug a crystal report?
Do you setup markers or flags to output? Is there an error log somewhere which describes which field the report is having an issue with etcs?
Your 'no records' empty report can be caused by some inexpected 'default' links between tables that CR would add each time you modify the list of tables and views needed for the report. There is this 'intelligent linking' option that can even automatically create some recursive links. Be carefull while looking at these in the relations screen, as they might not be viewable 'at once'. Another situation leading to 'empty' reports is when tables are linked with an inner join instead of an outer join, or when outer joins should be switched between left and right.
If you cannot find which relation(s) is causing your report to be empty (sometimes it is not so obvious), I advise you to make some trial & errors test by adding/removing tables or modifying your links.
You should get an error if there is an issue with the report. I'm guessing there is some logic in a join or display formula that is blanking the report. Can you verify the datasource is correct?
You can catch more errors if you handle the CrystalReportViewer error event (are you using .net?). I don't have much experience with the VS built-in designer. I use CR XIr2 standalone designer, which makes it much much easier to build reports.