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

Combine multiple rows to multiple Columns 1

Status
Not open for further replies.

dscoiho

MIS
Sep 26, 2005
51
US
I am using Crystal XI2. I have the following sample of how the data is structured.

Column A Column B
1 A
1 B
1 C
2 B
2 C
2 D
2 E
3 F
and I need Column B to either column with one row for Column A, or concatenated would work. I can have up to 22 columns.

Column A Column 1 Column 2 Column 3 Column 4
1 A B C
2 B C D E
3 F
Thanks in advance for any help

 
Do you kno what the values in column B could be? Are they all letters from the alphabet? if so, there is a way this can be done.
You could create a formula field that checks the value and shows it eg.

If column_b = "A" then
column_b
else ""

and then you would have a formula field for b, c, d, e etc.

you could then group by column_a and drop all the formula fields lined up onto the report.
 
What you're after looks like a crosstab. (Found under Insert.)

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Insert a group on {table.colA}, drag the groupname into the group footer, and then create formulas like these:

//{@reset} for the group header:
whileprintingrecords;
stringvar x;
if not inrepeatedgroupheader then
x := "";

//{@accum} for the detail section (suppress this formula):
whileprintingrecords;
stringvar x := x + {table.colB} + " ";

//{@display for the group footer}:
whileprintingrecords;
stringvar x;
trim(x)

Suppress the group header the detail section.

-LB
 
As always LB you are an unlimited wealth of knowledge. This worked for what I needed. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top