Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Maximum Date Post Reply Post New Topic
Author Message
rusty
Newbie
Newbie
Avatar

Joined: 07 Mar 2008
Location: United States
Online Status: Offline
Posts: 16
Quote rusty Replybullet Topic: Maximum Date
     Posted: 13 Mar 2008 at 5:31pm

I want to get {EmpHJob.EjhJobEffDate} with maximum ({EmpHJob.EjhDateTimeCreated}). How can I do it?

{EmpHJob.EjhJobEffDate} where maximum ({EmpHJob.EjhDateTimeCreated})

Thanks for help.

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 14 Mar 2008 at 1:37pm

Can you add a sort on EjhDateTimeCreated in descending order?  If so, then you can use the group header at the level where you want this date to display your data.

For example, from one of my reports, I have group in the following order:
 
Lender Number
Loan Number
Parcel Number
 
If I want to know the most recent date when a parcel was posted to history, I then sort descending on {tax_line_History.Posted_To_History_Date} and use the Parcel Number group header section(s) for my data instead of using the details section(s).
 
-Dell
IP IP Logged
sobie
Newbie
Newbie


Joined: 09 Jan 2008
Location: United States
Online Status: Offline
Posts: 5
Quote sobie Replybullet Posted: 21 Mar 2008 at 9:23am
You can create a Command Object. A simple one using Oracle systax would be something like:
 
select id, effdt, name
from table a
where a.effdt=
(select max(effdt)
from table a1
where a1.id=a.id
and a1.effdt <= sysdate)
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 24 Mar 2008 at 12:46pm
Commands can be a great help, but Crystal doesn't give you the option to create them for all databases.  And, if you're using multiple tables, you really need to know enough SQL to include all of them - it's possible to create a command for some data and link it to tables for the rest of the data, but sometimes when you do that Crystal isn't smart enough to send it to the database in such a way that everything is filtered out there instead of bringing all of the records from all of the tables down to the workstation for them to be filtered there.
 
-Dell
IP IP Logged
sobie
Newbie
Newbie


Joined: 09 Jan 2008
Location: United States
Online Status: Offline
Posts: 5
Quote sobie Replybullet Posted: 24 Mar 2008 at 12:50pm
You can create parameter fields in the Command Object to bring back only the data you need. I have not had a problem using this against Oracle tables. It sometimes slows performance. I have not had a need to use it against other databases. And, yes, you do need to know SQL. It is best to have a DBA check out the sql before you bring the system to its knees.
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