Print Page | Close Window

Current month

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10370
Printed Date: 05 May 2024 at 5:41am


Topic: Current month
Posted By: cfrey
Subject: Current month
Date Posted: 28 Jun 2010 at 9:29am
Hello,

I am selecting data and accumulating money based on whether a date is in the current month or the current month last year.

I Currrently am using MonthToDate and LastYearMTD. But I need to see any future records for this month also.

As an example if it is June 15 and my record is dated June 30 it will not show in my report.

What would be the easiest way to handle this?

Thank you/



Replies:
Posted By: lockwelle
Date Posted: 29 Jun 2010 at 3:54am
local numbervar thisMonth := MONTH(today);
local numbervar thisYear := YEAR(today);
local numbervar dataYear := YEAR({table.field});
 
if MONTH({table.field}) = thisMonth then
  if dataYear = thisYear or dataYear = thisYear - 1 then
    //good data
  else
    //bad data
else
  //bad data
 
should work...
 
HTH



Print Page | Close Window