Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: converting row to column in single group Post Reply Post New Topic
Author Message
Shivacon
Newbie
Newbie
Avatar

Joined: 17 Sep 2009
Location: India
Online Status: Offline
Posts: 26
Quote Shivacon Replybullet Topic: converting row to column in single group
    Posted: 22 Aug 2010 at 11:56pm

Hi,

I have a five records within the single group. For example

number  user  acct
----------  ----    ----
1            abc   123
1            asd   124
1            asc   125

Here, "number" column is a group. In this group, I need to show the "user" column as "abc,asd,asc" in single line. Please any one of you help me.

Thanks,
Shiva
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Aug 2010 at 3:38am
1) suppress the detail section
2) create a formula and place in the details section:
shared stringvar allUser := allUser + ", " + {table.userField};
3) in group header place a formula like:
shared stringvar allUser := ""
4) in group footer place a formula like:
shared stringvar allUser
 
HTH
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Aug 2010 at 3:39am
oops, 4) should be:
shared stringvar allUser;
mid(allUser, 3);  //this will remove the leading ', '
IP IP Logged
Shivacon
Newbie
Newbie
Avatar

Joined: 17 Sep 2009
Location: India
Online Status: Offline
Posts: 26
Quote Shivacon Replybullet Posted: 23 Aug 2010 at 4:08am
Thanks for your reply....
I need to display this in the "Number" group header and without duplicates. That is same "User" should not come. For example,
number  user  acct
----------  ----    ----
1            abc   123
1            asd   124
1            asc   125
1            abc   123
 
then it should be like "abc,asd,asc".I want to display this in the group header.


Edited by Shivacon - 23 Aug 2010 at 4:31am
Thanks,
Shiva
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Aug 2010 at 8:05am
can't do it unless you create a subreport to return the value.  This 'value' is unknown at the time of the report creation, and is a 'non-standard' way of displaying the information...you can put in a footer without the subreport, but to be in the header, you need a subreport.
IP IP Logged
Shivacon
Newbie
Newbie
Avatar

Joined: 17 Sep 2009
Location: India
Online Status: Offline
Posts: 26
Quote Shivacon Replybullet Posted: 23 Aug 2010 at 8:10pm
Thank you. How can I avoid duplicate?
Thanks,
Shiva
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Aug 2010 at 5:14am
check that instr()=0 for the new entry so something like:
shared stringvar allUser;
 
if instr(allUser, {table.userField}) = 0 then
  allUser := allUser + ", " + {table.userField};
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.