Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping issues 1

Status
Not open for further replies.
Sep 8, 2005
54
0
0
US
Using Crystal 10 connecting to MS SQL 2000 via ODBC.

I could do the following with subreports but would prefer to not deal with the complexity and the performence hit involved.

The desired group hierarchy is as follows:
child
|
|--appts
|
|--parties
|
|--presents


with incoming data:
ID,child_name,child_birth,doc_name,doc_loc,appt_dt,child_name_bd,child_party_dt,child_pres
2,Billy,7/19/1997,Dr. Smith,125 Main,12/15/2005,Sally,1/3/2006,Books
2,Billy,7/19/1997,Dr. Smith,125 Main,12/15/2005,Sally,1/3/2006,Clothes
2,Billy,7/19/1997,Dr. Smith,125 Main,12/15/2005,George,1/30/2006,Books
2,Billy,7/19/1997,Dr. Jones,811 First,1/17/2006,Sally,1/3/2006,Books
2,Billy,7/19/1997,Dr. Jones,811 First,1/17/2006,Sally,1/3/2006,Clothes
2,Billy,7/19/1997,Dr. Jones,811 First,1/17/2006,George,1/30/2006,Books


with the results in the form:
Code:
Billy   7/19/1997

Appts                                          Parties
--------------------------------------         ----------------------------------------
12/15/2005  Dr. Smith     125 Main              01/03/2006  Sally
01/17/2006  Dr. Jones     811 First                Books
                                                   Clothes
                                                01/30/2006  George
                                                   Books

The first group is obviously based on child (I use child_name & ID), but I'm not really sure where to go next. Any and all help would be appreciated.

thanks as always,
damon
 
Since you want listings alongside each other, you might need to preprocess the data in an SP or View to provide the output required.

Within Crystal you might fill arrays with the columnar data, and then display them. An example might be for the parties:

Group header formula:
whileprintingrecords;
stringvar MyAppts1:="";
stringvar MyAppts2:="";
stringvar MyAppts3:="";

Details formula:
whileprintingrecords;
stringvar MyAppts1;
stringvar MyAppts2;
stringvar MyAppts3;
if not({table.doc_name} in MyAppts) then
(
MyAppts1:=MyAppts1&{table.appt_date} & chr(13);
MyAppts2:=MyAppts2&{table.doc_name} & chr(13);
MyAppts3:=MyAppts3&{table.doc_loc} & chr(13);
// do the same for MyParties
// This appends in the data for each line

Group footer formula (this is where you display:
//The doc addresses
whileprintingrecords;
stringvar MyAppts1;
left(MyAppts1,len(MyAppts1)-1);

The doc names:
whileprintingrecords;
stringvar MyAppts2;
left(MyAppts2,len(MyAppts2)-1);

you get the idea...

You might do this with arrays as well.

-k
 
I'd definately be willing to not have the data side by side, but rather have it in a linear fashion.

thanks,
damon
 
FYI, I ended up using subreports as it ended up being less complex than using arrays. Also, I'm using a command parameter to choose the person, so it limits the scope of how many times the subreports are done. Thanks to Synapse for the array idea, even though I didn't end up using it.

damon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top