Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Combine Rows in Report with different values Post Reply Post New Topic
Author Message
93AUTiger
Newbie
Newbie
Avatar

Joined: 25 Jul 2012
Location: United States
Online Status: Offline
Posts: 2
Quote 93AUTiger Replybullet Topic: Combine Rows in Report with different values
    Posted: 25 Jul 2012 at 10:32am

Okay, fairly new to the Crystal Reports interface, but have some MS SQL queries before and have formal database training. I am using Crystal Reports 2011.

Having said that, I have created a report that pulls contribution amounts for employees to their 401K accounts. Within the Oracle database I have to query, there are separate records for each deduction on an employee's check. There are two types of employee contributions, and there is the employer match. The employee contribution has to be either one type or the other.
 
So I created a selection criteria from that table to pull records that are one of the three types:
 
{EMP_DED.DED_NUM} in [399.00, 400.00, 498.00]
 
Doing this, I get two lines per employee detailing their deduction amounts. I need to produce a report (to a CSV export) that has one line per employee, with one column containing their deduction for either type 399.00 or 400.00, and a second column detailing the 498.00 type deduction.
 
I feel the solution is either with grouping or my record selection criteria, but can't find a solution as of yet.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 26 Jul 2012 at 4:29am
Group by employee and put the data in the group footer.  You'll use formulas to get your amounts.  The one for type 498.00 would look something like this:
 
numbervar employer_match;
if OnFirstRecord or {employee.emp_id} <> previous({employee.emp_id}) then employer_match := 0;
if {EMP_DED.DED_NUM} = 498.00 then employer_match := {EMP_DED.amount};
employer_match
 
The formula for the employee contribution would be similar.
 
-Dell
IP IP Logged
93AUTiger
Newbie
Newbie
Avatar

Joined: 25 Jul 2012
Location: United States
Online Status: Offline
Posts: 2
Quote 93AUTiger Replybullet Posted: 26 Jul 2012 at 5:02am
Thanks for the assist hilfy!! Smile

Should my record selection be changed, or not?

And, are you indicating that there should be nothing in the Details section?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 26 Jul 2012 at 6:10am
You don't need to change the record selection and correct, there should be nothing in the details if this is the only data that you will export.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.