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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare and Concatenate String Field within Group 1

Status
Not open for further replies.

shenay921

Programmer
Sep 22, 2005
40
US
Hi There,

Using Crystal XI, Windows XP

I've been reading through the posts and have had some luck with (@reset,@accum,@display).

I have for fields: StreetName, PrimKey, BigPage, SmallPage

The data example:

Group: 1st Street
Details:
1st Street; 21976; 3104; 2073;
1st Street; 21972; 3104; 2073;
1st Street; 21876; 3004; 566;
1st Street; 11957; 3505,3506; 405,406;
1st Street; 25976; 3506; 407;
1st Street; 20976; 3506; 407;
1st Street; 19986; 3508; 470;
1st Street; 15648; 3502; 401;

I want the Group Footer to be:

1st Street; ; 3004,3104,3502,3505,3506,3508; 401,405,406,407,470,566,2073;

Is this even possible with some kind of loop statement? It's for an index for a map book.

Thank you,

Laura



 
Laura

//{@part1}:
stringvar array x := split({Fieldname},";");
x[2]

//{@part2}:
stringvar array x := split({Fieldname},";");
if ubound(x) >= 2 then
x[3]

//{@part3}:
stringvar array x := split({Fieldname},";");
if ubound(x) >= 3 then
x[4]


Will break field down into constituent parts

you can then extend

//{@part1}:
Whileprintingrecords;
stringvar array x := split({Fieldname},";");
//x[2]

global stringvar part1list:= part1list+", "+ x[2];

//{@part2}:
Whileprintingrecords;
stringvar array x := split({Fieldname},";");
if ubound(x) >= 2 then
//x[3]

global stringvar part2list:= part12list+", "+ x[3];

//{@part3}:
Whileprintingrecords;
stringvar array x := split({Fieldname},";");
if ubound(x) >= 3 then
//x[4]

global stringvar part3list:= part13list+", "+ x[3];


In report or group footer

@display Part1list
Whileprintingrecords;

global stringvar part1list;

Ian

 
Thanks for the help Ian.

--Ok, I tried putting the @part1 into the details along with the global variable -- it did not like any array number except 1:
--

Whileprintingrecords;
stringvar array map := split({CorrectLargeIndex_.Ext# Map Page},";");
if ubound(map) >= 1 then
map[1];

global stringvar part1list:= part1list+", "+ map[1];

--Then I inserted the footer note as well as a reset for each group:
--

Whileprintingrecords;

global stringvar part1list;

@reset:
whileprintingrecords;
stringvar part1list;
if not inrepeatedgroupheader then
part1list := "";

-- But I still get duplicates and out of order. I'm not sure where to put the @part2 and @part3 since I have to make the array a [1].
 
They all go in details. The array numbers just return the the elements. The split function creates an array with as many elements as you have ;

When you place this in details it will return "Ist Street" based on your example.

Sorry did not spot that you had duplicates.

YOu will need to add another step to test for duplicates

Split details in to two sections and suppress lower section and add this formula.
@dupTest

Whileprintingrecords;
stringvar array mapdup := split({CorrectLargeIndex_.Ext# Map Page},";");
if ubound(map) >= 1 then
mapdup[1];

global stringvar duptest:=mapdup[1];

Then in your main formula partlist1 formula

Whileprintingrecords;
stringvar array map := split({CorrectLargeIndex_.Ext# Map Page},";");
if ubound(map) >= 1 then
map[1];
If global stringvar duptest <> map[1] then
global stringvar part1list:= part1list+", "+ map[1];

Not sure what you mean by out of order.

Please post sample of data, sample ofwhat output you are getting and example of what you want to see.

Ian



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top