Solved

Crystal Reports report help with multi tables

Posted on 2013-01-17
4
356 Views
Last Modified: 2013-01-18
Hi. We have a database that holds 2 tables 1 named  summary and one named detailed. Both tables have a common field policy number. Reports are normally run from the summary table which summaries finance data etc..... I need to create a report that will show amounts for different payments but in a summary line of data. So policy number 123 has payments of 100 in the summary table. In the detailed table the same record is shown 3 times as the payment is split into 3 different types, clothing 30, food 30 and travel 40. I'm trying to create a report that can show the summary data and in addition the clothing payments, but show all records from the summary table. So for example policy number 123 payments 100 clothing payments 25, if no clothing payments are present then return null or zero. When I link the tables and run the report their policy number is duplicated as it is matching the record from the summary table with the multi records in the detailed table, I only want one line of data. Any suggestions
0
Comment
Question by:George_Milton
4 Comments
 
LVL 42

Assisted Solution

by:zephyr_hex (Megan)
zephyr_hex (Megan) earned 50 total points
ID: 38789673
it sounds like you need to create a group on Policy Number in your report and put the fields from the summary table in the section for the Policy Number group.
if you then want to show detail records, the fields from the details table would go in the Details section of the report.

if this does not sound like your solution, would you please provide the SQL query from the report?  you can get it by using Database->Show SQL Query in the report.
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 50 total points
ID: 38790213
Agree, you need to group the data and use the group header/footer for the displayed data.

If you can explain how the detail records are it would help determine what other formulas are needed.

For insance if you have a $100 payment split as you show above is there 1 detail record or 3?

mlmcc
0
 

Author Comment

by:George_Milton
ID: 38792097
Hi, thanks for your help so far, just a bit more detail.
The summary table has a record that looks like this
Policy number      Total Payments
12345                    100

In the detail table the same record looks like this
Policy number        Payment Desc        Payment amount
12345                     Clothing                  30
12345                     Food                        40
12345                     Travel                      30

So the record is present 3 times in the detailed table. Im looking for one line of date that would look like this
Policy number Total Payments Clothing payments
12345               100                   30

When I create the links for the tables I use the policy number to match. I think have a formula which looks at the Payment desc, if this equals clothing then show the payment amount
When I run that is part works but the policy number is duplicated the amount of times that it appears in the detailed table, so I get the following

Policy number   Total Payments   Clothing Payments
12345                 100                      
12345                  100                    30
12345                  100                            

I really just want to see one line of data as follows

Policy number Total Payments Clothing payments
12345               100                   30


I hope that makes some sense, I only really have a basic understanding of Crystal. (the data given is just an example)

Thank
0
 
LVL 77

Accepted Solution

by:
peter57r earned 195 total points
ID: 38792594
You have two options in Crystal to handle this.
You can suppress detail lines where the decsription is not Clothing by setting a suppression formula of:
{yourtable.descriptionfield}<>"clothing"

This is done in the Conditional format button for Suppress option in the section expect for the Detail Section.


The alternative is to base your report on a SQL command.
You have to create this in the syntax that is used by your database.  Select the Add Command option from the database expert once you have selected the database.

It will be something like..

Select Summarytablename.*, q1.* from
summarytablename left join
(Select * from detailtablename where description = "Clothing") as q1
on summarytablename.Policynumber = q1.policynumber

You cannot use the select expert in crystal for this requirement because you want to show all records from the summary table and the two features do not work together.
If you did Not want to show all summary records, just those with clothing records in the detail table, then you Could use the select expert.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now