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!

combine multiple rows to make one row? 1

Status
Not open for further replies.

nb4884

IS-IT--Management
Aug 2, 2010
141
US
Hello All,

I have 2 columns

Game Player
Basketball A
Soccer B
Hockey C
Soccer D
Basketball E
Soccer F

I need to display these records in 3 text boxes in group footer which would display as

Basketball A, E

Soccer B, D,F

Hockey C and so on.

Additional Info: My report is already grouped by ID which is the ID of Team
CR version XIR2

Thanks
 
Is the team ID limited to only one sport/game?

-LB
 
No there can be multiple sports/games under 1 Team

(Team here stands for communities : for exxample each community can have any number of sports/games and there are n number of communities.


Thanks
 
Okay, add a second group on sport and then use the following formulas:

//{@reset} to be placed in the sport group header (GH2):
whileprintingrecords;
stringvar players;
if not inrepeatedgroupheader then
players := "";

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

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

-LB
 
Thanks, but is there any other option without adding another group.

I have a large report and this is one section of it. Grouping by sport will affect the whole report. I have 5 sports.(which is not going to change)
 
Grouping by sport is the best approach. Otherwise, you could set up a formula that uses one variable for each sport, like this:

//{@detailformula}:
whileprintingrecords;
stringvar bask;
stringvar hock; //etc.
if {table.sport} = "Basketball" then
bask := bask + {table.player}+", ";
if {table.sport} = "Hockey" then
hock := hock + {table.player}+", ";
//etc.

You would need a reset in GH1:
whileprintingrecords;
stringvar bask;
stringvar hock;
if not inrepeatedgroupheader then (
bask := "";
hock := "" //etc.
);

Then in the GF1 use a separate display formula like this following for each sport:

whileprintingrecords;
stringvar bask;
if len(bask)>2 then
"Basketball: "+ left(bask,len(bask)-2)

-LB
 
Very GOOD LB!!!!!

Thanks a lot, that solves my problem and give the desired results.

Thanks..
 
Hi Lbass,

The above method works very well, my requirement has changed a bit.....

Everything else remains the same but is there a way to get the results in lines and not separated by comma. For example name of one player(A) under a particular game(basket ball) and name of next player(E) for same game in next line and not separated by comma (Dont want to displat A,E but A and the E in next line)

Thanks a lot!!!
 
You can replace the ", " in the formula with chr(13), and then format the display formula to "can grow".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top