Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Current and Prior Year Post Reply Post New Topic
Author Message
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Topic: Current and Prior Year
    Posted: 29 Jun 2016 at 11:53am
I am using CR 2010. I am building a report off a SQL command that's been loaded into my report. I need to only pull the current and prior year from the following field: Command.Date Stamp. It is formatted as DateTime.

Any help with the formula for is appreciated, thanks!
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 30 Jun 2016 at 5:10am
If I am using an SQL command.  I normally put the filter in with the command.  It depends on the database vendor (Oracle, MS-SQL, MySQL, etc.) on how to get the current and prior year.  Otherwise you could use a selection formula.  There a number of ways to do it.  But it would be best if you provide us exactly what you mean by current and prior year (Fiscal year, calendar year, year to date, etc.)
IP IP Logged
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Posted: 30 Jun 2016 at 6:16am
The database is SQL Developer for Oracle.

By Current year and prior year I mean this calendar year (2016) and last calendar year (2015) and when the new calendar year hits on January 1, the report will automatically display only 2017 and 2016 records.

I may have found a formula that works in Crystal:
year({Command.Date Stamp})>= year(currentdate)-1

I inherited the SQL command, and am not as versed in that language yet, but am much more comfortable in the Crystal environment.

Thank you!
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
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.