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

Create a string from multiple rows 1

Status
Not open for further replies.

FireGeek21

Technical User
Dec 12, 2007
218
US
I need to create a string from multiple rows of data. Data example:

Code Dept Req
1 A CPR
1 A ACLS
1 A PALS
2 X BA
2 X BS

In theory, I need the above to be created into two rows:

Code Dept Req
1 A CPR,ACLS,PALS
2 X BA,BS

How can I get the Req column to loop through however many rows may exist (which vary) to then put the Reqs into one string?

Would this be easier done in Excel or Access? How?

FireGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
Insert a group on code and then on Department. Then create three formulas:

//{@reset} to be placed in the Department group header:

whileprintingrecords;
stringvar x;
if not inrepeatedgroupheader then
x := "";

//{@accum} to be placed in the detail section and suppressed:
whileprintingrecords;
stringvar x := x + {table.req} + ",";

//{@display} to be placed in the Department group footer:
whileprintingrecords;
stringvar x;
if len(x)>1 then
left(x,len(x)-1)

Drag the groupnames into the Group Footer #2 (Dept), add the display formula and then suppress the group headers and detail section.

-LB
 
Thank you LBass! Worked perfectly!

Some day I really need to learn more about the WhilePrintingRecords. I'd also like to learn more about the other functions like InRepeatedGroupHeader.

Again, thank you!

FireGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top