Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Getting Last Date Post Reply Post New Topic
Author Message
SATELE01
Newbie
Newbie
Avatar

Joined: 13 Aug 2012
Location: United States
Online Status: Offline
Posts: 24
Quote SATELE01 Replybullet Topic: Getting Last Date
    Posted: 27 Aug 2012 at 10:04am
In an SQl database I have multiple pay date records. I have two questions
 
1. How - in a formula - do I select the latest dated record?
 
2. How do I select a range of dates in a formula to get YTD data?
 
ANy help would be appreiated
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Aug 2012 at 10:21am
Are asking a SQL question or a CR question?  If it is a CR question, for #1 you can't in a formula.  If you group by pay date records ascending, then the last group with have the latest dated record.  #2 I believe you can create a formula using the dateadd function that will achieve what you want (it have to be a record selection formula), Something like this {someDatefield} >= dateadd"yyyy",{?dateparm1},-1) and {someDatefield} <= dateadd("yyyy",{?dateparm2",-1}.

I hope this helps.
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.016 seconds.