Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a "next full month" formula 1

Status
Not open for further replies.

Pablito9

IS-IT--Management
Jan 1, 2006
22
NL
Hi,

CR XI-R2 user

Is there a formula such as LastFullMonth but for the next full month?

What I would like to achieve is to display 5 columns based on the field {OrderRel.ReqDate}.
The first 2 columns are no problem.

1 column.- last month and all in the past
if {OrderRel.ReqDate} <= LastFullMonth then {OrderRel.Amount}

2 column.- current month
numbervar jaarRD := Year ({OrderRel.ReqDate});
numbervar maandRD := Month ({OrderRel.ReqDate});
numbervar jaarHD := Year (CurrentDate);
numbervar maandHD := Month (CurrentDate);
if jaarHD = jaarRD and maandHD = maandRD then {OrderRel.Amount}

3 column.- should be the first full next month from {OrderRel.ReqDate}
(so if {OrderRel.ReqDate} = 11/07/2007 then this column should show the values in the range 12/01/2007 to 12/31/2007)

4 column.- should be the second full next month from {OrderRel.ReqDate}
(01/01/2008 to 01/31/2008)

5 column.- should be the third and future full next month from {OrderRel.ReqDate}
(02/01/2008 to future)

Really I have no idea how to resolve this issue, please advice.

Thanks

Erik

 
Several ways. Find the month difference, e.g.
Code:
DateDiff ("m", {OrderRel.ReqDate},  currentdate)
If you need to show the dates, get a date in that month using
Code:
DateAdd ("m", 1, currentdate)
The start of the month can be found as
Code:
Date (Year(@NextMonthDate),Month(@NextMonthDate), 1)
Add another month and then subtract a day to get the last date in the month.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Many thanks for your help. This solved mine problem.

Erik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top