Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Getting Data On One Line Post Reply Post New Topic
Author Message
poppy
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 4
Quote poppy Replybullet Topic: Getting Data On One Line
     Posted: 02 May 2011 at 2:40am

Hi everyone! This is kind of a reponse to this post: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5081&PID=15132

I am too new to CR but i know my way around it a little. I tried this method, and it don't seem to work for me. I need to get data on one line. For example, for my data.. I have this:
Child_ID
Child_BirthDate
Child_LastName
(this data is on the same table)
 
Referral_Num
(this data is on another table)
 
For referral_num, there are many referral numbers a child can have (up to 5). I need to display them all on one line.
 
The data comes out like this:
 
Example:
 
LastName   Child_ID   Child_BirthDate   Referral_Num
Smith          001          4/5/2010             1
Smith          001          4/5/2010             2
Smith          001          4/5/2010             3
Smith          001          4/5/2010             4
 
I want the data to come out like this instead:
 
LastName   Child_ID   Child_BirthDate   Referral_Num   Referral_Num  
Smith           001           4/5/2010            1                      2           
 
Any recommendations or suggestion? Any form of suggestions or recommendations is greatly appreciated!
  
 


Edited by poppy - 02 May 2011 at 4:38am
IP IP Logged
Stang67
Newbie
Newbie
Avatar

Joined: 14 Apr 2011
Online Status: Offline
Posts: 12
Quote Stang67 Replybullet Posted: 02 May 2011 at 5:43am
Hi poppy,

i had the same Problem like you, our solution was a pivot table.
(We are using the MSSQL 2008)

Here is a little 'How to' for the Pivot-Table
http://www.kodyaz.com/articles/t-sql-pivot-tables-in-sql-server-tutorial-with-examples.aspx

Hope it will fix your Problem :)

Regards
Stang67
IP IP Logged
poppy
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 4
Quote poppy Replybullet Posted: 02 May 2011 at 5:47am
thank you for your reply Stang67, but we need this data to on crystal reports. Is there any way we can do this?
IP IP Logged
Stang67
Newbie
Newbie
Avatar

Joined: 14 Apr 2011
Online Status: Offline
Posts: 12
Quote Stang67 Replybullet Posted: 02 May 2011 at 6:14am
Sorry, maybe I expressed myself wrong.
We load the data from MSSQL and i build a SQL-Statemant with a Pivot-Table (Pivot-Select) in it.
So you can use it in the crystal reports.

If you want to build this construct directly in CrystalR , so i am not sure about that, sry :)
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 04 May 2011 at 2:55am
I would use an array, of size 5. Group on the child, add a counter c to the detail where the referrals are , and put the referral number into array[c] for each row.
Then the child data can go in the group footer, along with array[1], array[2] etc  and you can suppress the detail lines
You will have to make sure to reset the array for the next group in case there are a different number of referrals, you don't want them carrying over if they should be blank.
 
 
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