Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Maximum Date Across Tables Post Reply Post New Topic
Author Message
CigJDD
Newbie
Newbie


Joined: 03 Jun 2015
Online Status: Offline
Posts: 3
Quote CigJDD Replybullet Topic: Maximum Date Across Tables
     Posted: 12 Jun 2015 at 3:42am
I am looking to write a formula that would return 1 Maximum date only based on two tables.  when I use Maximum in a formula it returns a value of "True/False" and/or a list of several dates including the max date.
 
Tables look like the following
 
 
Table 1          Table2
 
userid            userid         dates
joeuser          joeuser        1/1/2000
                    joeuser        12/1/2000
 
I need to take the userid from table 1 and match it with the Max date in Table 2.  Results would look like:
 
joeuser         12/1/2000
 
Additionally, supressing seems to leave me with blank fields but a maximum date.  I dont want to see the blank fields
 
This is what I end up with given the following formula
 
{Table2.CredentialDt}=Maximum{table2.CredentialDt},{table1.userid})
 
 


Edited by CigJDD - 12 Jun 2015 at 4:00am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 12 Jun 2015 at 4:05am
You're getting the true/false because the "=" in this case is doing a comparison. I think this is the something like formula you describe:

If {table1.DateField} > maximum({table2.CredentialDt},{table1.userid}) then
{table1.DateField}
else
maximum({table2.CredentialDt},{table1.userid})

If you're looking for just one record to show, put all of the data, including this formula, in a userid group header section. Then suppress the details and the userid group footer section.

-Dell

IP IP Logged
CigJDD
Newbie
Newbie


Joined: 03 Jun 2015
Online Status: Offline
Posts: 3
Quote CigJDD Replybullet Posted: 12 Jun 2015 at 4:30am

Thank you that worked!

 
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