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

Joining Distinct Strings in a Group Summary formula 1

Status
Not open for further replies.

racskelly

IS-IT--Management
Apr 19, 2007
37
CA
I want to join the unique data in a field into a string for each group...


lets say my data set is


1 Red
2 Blue
3 Green
4 Red
5 Yellow
6 Blue

i want to show a formula in the group for these rows that indicates the distinct colors separated by commas:

so for this example

Red, Blue, Green, Yellow

i don't care what order they are in...as long as it is the distinct set ...

I've tried using whileprinting recrods with a createCategory, calculateCategory and displayCategory fields...but I can't get it right... thanks!
 
What are you grouping on? You don't show a field that is constant across these records. Anyway, create three formulas:

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

//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar x;
if instr(x,{table.color}) = 0 then
x := x + {table.color} + ", ";

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

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top