Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Data Retrieval help please Post Reply Post New Topic
Author Message
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Topic: Data Retrieval help please
    Posted: 18 Oct 2010 at 6:24am

I am joining two tables.

Customer table has a one to many relationship with Inventory table

I just want to pull back the customer table rows with the most recent row on the inventory table for that customer. There is a date on the inventory table so is it possible to tell crystal reports to just pull back the customer row along with the most recent row on the inventory table?

 
Any help will be much appreciated!
IP IP Logged
tschmid41
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 4
Quote tschmid41 Replybullet Posted: 18 Oct 2010 at 10:38am
You should just be able to select the MAX of the date.  That will return the latest(most recent) date.
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 19 Oct 2010 at 4:29am
Can you explain to me exactly how this will work?
IP IP Logged
tschmid41
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 4
Quote tschmid41 Replybullet Posted: 19 Oct 2010 at 4:45am
You will have to go into the Select Expert and create a custom formula that says where [date column] = Max([insert date column here]).  The Select Expert is located on the toolbar and looks like a hand pointing to a couple of marbles.
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 19 Oct 2010 at 5:03am
Yeah I understand that but this will just bring back one row as being the max for every report. I want the max date per customer. So if there are ten customers on the report I want the max date for each of their inventory items, so ten dates, not one max date for the whole report.
 
For example: My report is currently showing:
 
 
Customer             Inventory No:
 
John                         200
John                         300
John                         400
Michael                     700
Michael                     800
Michael                     900
 
 
I want it to show:
 
Customer             Inventory No:
 
John                         400
Michael                     900
 


Edited by colman1212 - 19 Oct 2010 at 5:09am
IP IP Logged
tschmid41
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 4
Quote tschmid41 Replybullet Posted: 19 Oct 2010 at 5:21am
So add an AND statement which matches the customer names of the max and the other row.  Not currently sure about the syntax of that, I'll have to take a peak here a bit later today.
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 19 Oct 2010 at 5:26am
Thanks for all your help.That doesnt really makes sense to me though. What do you mean by 'Other row'?
IP IP Logged
tschmid41
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 4
Quote tschmid41 Replybullet Posted: 19 Oct 2010 at 5:28am
By the "Other Row", all I'm referring to is the row it would be currently getting checked against.  I'll look into this and get back to you later today.
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.047 seconds.