cmatiuk
November 16th, 2007, 10:51 PM
Crystal Reports XI: I have the following input derived from an Access 2007 database query. The Report creates a form letter and groups on the uni_full field. The dynamic array that I’ve constructed, however, does not provide the output in a consolidated format as I would like. See the input, output examples, and code samples below. I’d really appreciate some assistance with this “multi-dimensional” or “nested array” problem—I’m really not sure how to call it. Thanks in advance for your suggestions.
Input:
-----
uni_full.............uni_univ..author_full.......comm_committee
Ronald Adams....OSU...,....R. Haggerty..,...Author
Ronald Adams....OSU.......Jeff McDonnell...Author
Ronald Adams....OSU.......Jeff McDonnell..Hydrologic Measurement Facility
Ronald Adams....OSU.......John Selker......Author
Ronald Adams....OSU.......John Selker.....Board of Directors (2005-2007)
Ronald Adams....OSU.......John Selker.....Hydrologic Measurement Facility
Current Output (I can build an array that will produce the following):
--------------------------------------------------------------------
Dear Ronald Adams (OSU),
The following people blah blah blah:
R. Haggerty (Author), Jeff McDonnell (Author), Jeff McDonnell (Hydrologic Measurement Facility), John Selker (Author), John Selker (Board of Directors (2005-2007)), John Selker (Hydrologic Measurement Facility).
Desired Output:
--------------
Dear Ronald Adams (OSU),
The following people blah blah blah:
R. Haggerty (Author), Jeff McDonnell (Author, Hydrologic Measurement Facility), John Selker (Author, Board of Directors (2005-2007), Hydrologic Measurement Facility).
I'm using this code to build the array:
-------------------------------------
//{@DynamicArrayBuilder}
whileprintingrecords;
stringvar array MyArrayComm;
global numbervar CountComm;
if not({qry_mailmerge_both.author_full} in MyArrayComm) then
(CountComm := CountComm + 1;
then (Redim Preserve MyArrayComm[CountComm];
MyArrayComm[CountComm] := {qry_mailmerge_both.author_full}+' ('+{qry_mailmerge_both.comm_committee}+')'));
And the following code to insert the array into the text:
--------------------------------------------------------
// used for displaying array info only
whileprintingrecords;
stringvar array MyArrayComm;
numbervar CountComm;
local stringvar PrintComms;
local stringvar LabelComms;
local numbervar i;
for i := 1 to CountComm step 1
do
(
if i = 1 then
(
PrintComms := MyArrayComm[i];
LabelComms := 'CUAHSI Author and/or Leadership Role: ';
)
else
(
PrintComms := PrintComms+', '+MyArrayComm[i];
LabelComms := 'CUAHSI Author and/or Leadership Roles: ';
)
);
LabelComms+PrintComms
Input:
-----
uni_full.............uni_univ..author_full.......comm_committee
Ronald Adams....OSU...,....R. Haggerty..,...Author
Ronald Adams....OSU.......Jeff McDonnell...Author
Ronald Adams....OSU.......Jeff McDonnell..Hydrologic Measurement Facility
Ronald Adams....OSU.......John Selker......Author
Ronald Adams....OSU.......John Selker.....Board of Directors (2005-2007)
Ronald Adams....OSU.......John Selker.....Hydrologic Measurement Facility
Current Output (I can build an array that will produce the following):
--------------------------------------------------------------------
Dear Ronald Adams (OSU),
The following people blah blah blah:
R. Haggerty (Author), Jeff McDonnell (Author), Jeff McDonnell (Hydrologic Measurement Facility), John Selker (Author), John Selker (Board of Directors (2005-2007)), John Selker (Hydrologic Measurement Facility).
Desired Output:
--------------
Dear Ronald Adams (OSU),
The following people blah blah blah:
R. Haggerty (Author), Jeff McDonnell (Author, Hydrologic Measurement Facility), John Selker (Author, Board of Directors (2005-2007), Hydrologic Measurement Facility).
I'm using this code to build the array:
-------------------------------------
//{@DynamicArrayBuilder}
whileprintingrecords;
stringvar array MyArrayComm;
global numbervar CountComm;
if not({qry_mailmerge_both.author_full} in MyArrayComm) then
(CountComm := CountComm + 1;
then (Redim Preserve MyArrayComm[CountComm];
MyArrayComm[CountComm] := {qry_mailmerge_both.author_full}+' ('+{qry_mailmerge_both.comm_committee}+')'));
And the following code to insert the array into the text:
--------------------------------------------------------
// used for displaying array info only
whileprintingrecords;
stringvar array MyArrayComm;
numbervar CountComm;
local stringvar PrintComms;
local stringvar LabelComms;
local numbervar i;
for i := 1 to CountComm step 1
do
(
if i = 1 then
(
PrintComms := MyArrayComm[i];
LabelComms := 'CUAHSI Author and/or Leadership Role: ';
)
else
(
PrintComms := PrintComms+', '+MyArrayComm[i];
LabelComms := 'CUAHSI Author and/or Leadership Roles: ';
)
);
LabelComms+PrintComms