Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Showing data Horizontal not vertical Post Reply Post New Topic
Author Message
boldon mackem
Newbie
Newbie


Joined: 26 May 2009
Online Status: Offline
Posts: 9
Quote boldon mackem Replybullet Topic: Showing data Horizontal not vertical
     Posted: 26 May 2009 at 12:33am
Is there any way you can show data horizontaly not vertically,   My data has several phone numbers against an account, when the field is dropped into the details section, the phone umbers list underneath eachother, can Iget then listed to the right of each other?
 
e.g.
 
 
Mr ABC     1234566      56455456   4546546
 
Not:
 
Mr ABC    1234566
Mr ABC    56455456
Mr ABC    4546546
 
Thanks,


Edited by boldon mackem - 26 May 2009 at 12:34am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 26 May 2009 at 6:21am
you would need to write a formula and then display the information in the group footer, not the details, because the simple answer is no.
 
Crystal doesn't know how many entries there are, and the simplest way to report is one line of detail for one line of data.  You have multiple lines of data that you want displayed as 1 line.
 
The function would be one way to do it, the other would be a subreport to generate the string...depends on if you want the information in the group header or footer, which kind of depends on if there is other information to be displayed in the details section than just the phone number.
 
HTH
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 May 2009 at 4:59am
Hi
 
You can do using SQL
 
first create function as below it takes ename as parameter and returns comma separated nos....

CREATE FUNCTION [dbo].[ufn_empnoname] (@ename varchar(50) )RETURNS VARCHAR(8000)AS

BEGIN
declare @DelimitedString varchar(500)
Select @DelimitedString = isnull(@DelimitedString + ', ', '') + cast(eno as varchar(20))
From table_en
Where ename =@ename
RETURN @DelimitedString
END
 
then use the select below,you can create view to get the results

Select distinct ename,[dbo].[ufn_empnoname](ename) from table_en

output

Mr Abc 123456, 56455456, 45465546
 
cheers
Rahul
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 27 May 2009 at 6:24am
Absolutely, I would agree, anything that you can do on the server is a benefit.  Wouldn't you want to declare @DelimitedString as VARCHAR (8000), I am sure that 500 is sufficient, but since you are returning 8000...
 
Just checking, that's a great function.  I didn't think something so simple would work, I thought that I would get lots of rows, not just one.
 
Thanks Rahul 
IP IP Logged
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