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

How to concatenate items in a field into a group summary

Status
Not open for further replies.

rleyba828

Technical User
Sep 29, 2004
53
US
Hi there, I would like to manipulate my tabular data into
something easier to read (one line instead of multiple lines).

My data looks like this:

Port-ID Desk# Staff
12A 22 John Doe
12B 22 John Doe
12C 22 John Doe
13A 43 Jane Doe
13B 43 Jane Doe
13C 43 Jane Doe
13D 43 Jane Doe

But I would like to Group (summarize) by Staff and have all the port-IDs concatenated together on one line on the group header field

i.e. I would like it to look like this

John Doe 22 12A,12B,12C
Jane Doe 43 13A,13B,13C,13D


Could someone direct me to the group maninpulation and formula field expression to do this?

Many thanks

 
Drag the staff and desk # fields to the group footer. Hide the detail section so that you don't see the duplicates.

Sort the details by Port ID

Then to get all the values of Port ID horizontally, write 3 formulas:

In the group header:
WhilePrintingRecords;
If Not InRepeatedGroupHeader then stringvar Port:=""

In the details section:
WhilePrintingRecords;
If OnFirstRecord the stringvar Ports:={PortID} else
If {PortID}=Previous({PortID}) then stringvar Ports:=ports else
strigvar ports:=Ports+","+{PortID}

In the group footer:
WhilePrintingRecords;
stringvar Ports;

If you are in an older version of crystal this may not work as the limit of a string output was 254 characters. You should always post your crystal version.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Hi dgillz,

Thanks very much for your post. But you are right, I do get the error message " A string can be at most 254 characters long."

I am using Crystal version 8.

Could you please recommend a workaround. Thanks.
 
Upgrade to XI. There is no workaround.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
yup....I must admit, the time has come!

Thanks dgillz.

 
Maccrystal,

This is great! This is exactly what I needed and yes it worked with version 8.

Many thanks!

--robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top