Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Returning records from a linked table Post Reply Post New Topic
Author Message
tropical John
Newbie
Newbie


Joined: 10 Jan 2010
Location: Australia
Online Status: Offline
Posts: 2
Quote tropical John Replybullet Topic: Returning records from a linked table
     Posted: 10 Jan 2010 at 8:54pm
Hi,
 
I need to return only the first instance of a matching record from a linked table.
 
Eg Table 1 linked to Table 2 using 'MemberNumber' field.
 
MemberNumber exists once only in Table 1 but multiple times in table 2.
I only require the MemberNumber returned for the first instance in table 2.
 
Any help would be greatly appreciated.
 
Regards,
 
John
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Jan 2010 at 6:03am
you could make a group based on MemberNumber and then only display the header (which would be the first member...depending on sorting criteria) and omit the detail section.
IP IP Logged
tropical John
Newbie
Newbie


Joined: 10 Jan 2010
Location: Australia
Online Status: Offline
Posts: 2
Quote tropical John Replybullet Posted: 11 Jan 2010 at 4:15pm
Thanks for that.
 
I will also be returning a number of other fields associated with that first record (status, product, date and some more) and will need to sort all records on product. Further I then need to group them by product and perform a count for each of these groups.
 
I am only new to crystal but have used foxpro to do this sort of thing in the past. I think I need to find some way of skipping all records after that first one in the lnked table 2 so that it does not get returned at all.
 
I had been thinking about returning all fields to an array and using a formula to skip the subsequent records but thought there may have been an easier way.
 
 
Cheers,
 
John
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Jan 2010 at 6:06am
How about creating a stored procedure to gather just the information that you need, instead of every record?  When it comes to data handling, SQL and the stored proc are way more powerful and versatile than CR.
 
HTH
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