How do i select records of crystal subreports dynamically - crystal-reports

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.

Related

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...

Items in details repeating itself in Crystal Reports

Situation
I got stucked to some weirdo in Crystal reports. See the image below of my RAW RPT.
Everything in my report is coming fine except the details part. You can see there DetailsSection6, in which i have few columns(10-15). This rpt is binded with the XSD file and that XSD is then binded with its concerned dataset at runtime. Dataset has around 10 tables from which two tables are concerned here.
PROC_CONS_SUBBILL_REPORT - Header Table with single row.
CON_T_SUBBILL_DTL - Detail table having multiple rows based on the VoucherNo of above table.
What I want
I need to display all records of detail table in tablular format based upon the VoucherNo. Say in detail table (SUBBILL_DTL), I am having 25 records, but when table is rendered on the rpt, its starts repeating itself, sometimes twice sometimes thrice.
Kindly note:
My SP is returning the expected and correct data
RPT has 5-6 SubReports and in one report PROC_CONS_SUBBILL_REPORT table is used.
There is no Relationships in the report in the form of keys.
What I did
Tried removing all keys between the tables.
Suppressed the Detail Section but it suppresses the entire data.
Suppress the detail section with formula
{CON_T_SUBBILL_REPORT.CODE}=previous( {CON_T_SUBBILL_REPORT.CODE})
but still its not working.
I am totally lost. Kindly help.
Normally records are duplicated when the linking is wrong, In your case instead of formula try to use the option Select Distinct Records under Database tab.
This is a little late, but in case somebody else is looking for an answer.
I tried all the things above and nothing worked. Crystal reports was changing my query.
It worked in SQL Server but not in Crystal Reports.
The way I fixed it was by creating a view of my query on Sql Server and using the view
in my Crystal Report. It fixed everything.

How to display individual reports in cyrtal reports

I am new in using crystal reports. I already tried to create a report but it doesn't look like what I wanted. What I want to create is an individual report of each employees where it displays their information like name, age, birth date, address, etc.. But then, crystal reports will display all reports of each employees in a single document. Is there any way that I could make each employees information to display in a single document like I could use an arrow to navigate to next employee information if I want to see their report?
By the way, I used Microsoft SQL R2 in getting data for my reports. Thanks.
hi the question is not clear..as my knowledge i suggest..that if you design
the crystal report of one employee in single document and attach stored procedure to that
report your problem is solved ..you will get every employee details in a serial order this is the answer if i understand your question correctly,if not can you please repeat the questi
on with changes which i can understand
thank 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.

Show Report group even when no records selected

I'm trying to show employees at a company grouped by worked and still working (in vs2005 crystal reports).
The user can pass by parameter a list of companies they want to show.
Tables: VRP-COMPANY, VRP-COMPANY-OPPORTUNITY, VRP-OPPORTUNITY-PRODUCT
The record selection formula: {VRP-COMPANY.COMPANY company} in {?companies}
Grouping is done on: VRP-COMPANY.COMPANY company, then formula to decide its working or worked and then on productname.
Now when I run the report I only get to see the companies who have got entries in the VRP-COMPANY-OPPORTUNITY. I want to see the company name (group) even if there are no entries in the opportunity table. How to do this in Crystal Reports? I tried Left join between company and company-opportunity tabel but no effect.
I found the problem. Left join was correct but I had an additional select formula (on opportunity status to be closed-won. Therefore it let out the record. The record can also be null when there are no opportunities.
Should the question be deleted?