-
June 28th, 2011, 04:55 PM
#1
Concatenate multiple rows
Hi,
Can you please tell me how to concatenate multiple row colums into one??
My Report consists of several tables joined by their User Id.....so i have to link all of them with left outer join.
For Example,
Users.UserID Info.Mobile Company.M0dels
1 Samsung 1
1 Nokia 2
2 Nokia 3
2 LG 4
changes into
Users.UserID Info.Mobile Company.Models
1 Samsung,Nokia 1,2
2 Nokia,LG 3,4
Here, Users, Info & Company are different tables left joined to Users..
Please help mee...asap
-
June 30th, 2011, 08:03 AM
#2
Re: Concatenate multiple rows
Welcome to codeguru forums !!!
To do that, you have to :
a)- Group by Users.UserID
b)- Create 3 formulas:
1.-The first one, let's call it @null:
Code:
whileprintingrecords;
stringvar names := "";
Place it in your Users.UserID Group Header section, it will return you null.
2.-The second one, let's say @comma_field:
Code:
whileprintingrecords;
stringvar names;
names := names & ", " & {Company.M0dels};
Place it in your Detailes section which you can suppress; the formula will return you next: ,1,2 or ,3,4
3.-and the 3rd formula, let's call it @final (or whatever you like):
Code:
whileprintingrecords;
stringvar names;
Mid(names, 2);
Place it in your Users.UserID GF section.
JG
-
July 3rd, 2011, 01:27 AM
#3
Re: Concatenate multiple rows
thanks for the reply..
But what does Mid(names,2) does??
-
July 3rd, 2011, 07:42 AM
#4
Re: Concatenate multiple rows
It will display the variable 'names' from the second characters to the last
(it will remove the first comma from variable 'names')
try & you will see
JG
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|