Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: grouping split details Post Reply Post New Topic
Author Message
Lisa C.
Newbie
Newbie
Avatar

Joined: 20 May 2008
Location: United States
Online Status: Offline
Posts: 3
Quote Lisa C. Replybullet Topic: grouping split details
     Posted: 20 May 2008 at 8:15am

I am trying to group together all the details for the same individual when some are actually split by parameters set as the primary group header.  Let me try to explain...

The report lists contributions grouped by category.  However, some individuals have given to more than one category so they show up twice on the report - once for category A and once for category B.  Additionally, the details for category A only list the contributions given to category A.  What I am after is a conditional statement that will pull the records from category B and add them to the records in category A if an individual gave to both categories.
 
Instead of this:
 
Group Header: Scholarships
Donor: Joe Smith
Category: Scholarships
Gift: 50.00
Total Gift: $75.00
 
Group Header: Annual Fund
Donor: Joe Smith
Category: Annual Fund
Gift $25.00
Total Gift: $75.00
 
It should be this:
 
Group Header: Scholarships
Donor: Joe Smith
Category: Scholarships
Gift: $50.00
Category: Annual Fund
Gift: $25.00
Total Gift: $75.00
 
Since Joe Smith gave to both funds, all his gifts are listed under the first fund and his subsequent record is removed so he only shows up once.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 May 2008 at 3:51pm
This is a tough one and you might not be able to do it the way you have it set up.
 
If you can group by Donor first, there's no problem.
 
I can think of two ways to get all of the categories from a single donor to list under your group:
 
1. (preferred method) Add a second copy of the table with the donation information.  (When you select a table that's already in the report Crystal will automatically rename it for you with "_1" at the end.)  So, assuming the table name is Donations, link from Donations to Donations_1 on the field(s) that identify the donor.  Group on the Category from Donations and use the data from Donations_1 for the detail data.
 
2.  Use a subreport that contains the donor table and links on the field(s) that identify the donor.
 
However, this doesn't prevent the donor's information from appearing twice.  You may be able to create an array variable to track the donor ID information and then use it to suppress the section(s) for any donor who's already in the array.  I haven't really worked with arrays in Crystal, so I'm not sure how to tell you to go about doing that, though.
 
-Dell
IP IP Logged
Lisa C.
Newbie
Newbie
Avatar

Joined: 20 May 2008
Location: United States
Online Status: Offline
Posts: 3
Quote Lisa C. Replybullet Posted: 22 May 2008 at 10:01am

There was a problem with my links in the subreport for the gift details.  Once I fixed that I was able to see all gifts per donor under the correct headers.  You are correct regarding the array - I contacted my db support team and a tech wrote some code for me.  I have pasted it below in case anybody else has the same issue with suppressing duplicate records.

Note: We want to show all of each Constituent's contributions together (as opposed to splitting them up as the report was doing).  The below steps work on  suppressing the names in the main report where they have already been displayed  previously.

 

6) In main report, create a formula to initialize the array which will hold CnBio_IDKEYs (as they appear in report):

 WhilePrintingRecords;

 NumberVar array x;

 NumberVar i := 0;

7) Place this formula in the main report, Report Header section.

8) In main report, create a formula to calculate when to add a new CnBio_IDKEY to array:

 WhilePrintingRecords;

 NumberVar array x;

 NumberVar i;

 Numbervar j;

 StringVar InArry := "False";

 For j := 1 to i do

 (

   If {CnBio.CnBio_IDKEY} = x[j] then

      InArry := "True"

 );

 If InArry = "False" then

 (

   i := i + 1;

   Redim Preserve x;

   x := {CnBio.CnBio_IDKEY}

 );

 i;

9) Place this formula in the main report, Group Header #3 section.

10) In main report, conditionally suppress Group Header #3 section based on the  following:

 WhilePrintingRecords;

 StringVar InArry;

 InArry = "True"

IP IP Logged
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