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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First and last dates of PREVIOUS month 3

Status
Not open for further replies.

eo

MIS
Apr 3, 2003
809
Hi

I had a look through previous searches, but cannot find a solution to my dilema!
I want to scedule reports to run (via CE10) on the first day of every month, but using Start Date and End Date parameters of the First Date and Last Date of the previous month. In simpler terms run the report for the whole of the previous month withoput anyone physically have to enter such parameters or call for such a report.
Are there formulas that will be able to help with this? I have done reports where it runs from the first date of a month till the last date of that month, but this is slightly different.
[blush]


Etienne Oosthuysen
Hertfordshire, England
 
What you're describing seems to be pretty much what the function LastFullMonth is for.

You don't seem to actually need parameters at all, so if you replace your StartDate and EndDate stuff with 'Date in LastFullMonth', this would seem to satisfy the criteria in your post.

All the best,

Naith
 
Thanks Naith and I think we are on the right track, but never used this function before, so not sure what to do with it...
I currently have two parameters set up:
?StartDate, and
?EndDate.

Would I delete the parameters, and use the select expert?
If I sched the report to run on the first of July, how would I set the report up to automatically run for the whole of June?

Thanks,


Etienne Oosthuysen
Hertfordshire, England
 
Okay, let's say, for the sake of argument your report criteria looks a little like this at the moment:
Code:
{My.Date} >= {?Start Date} and
{My.Date} <= {?End Date}
Now, you've already implied that you don't really need parameters, because {?Start Date} is always going to be the 1st of last month and {?End Date} is always going to be the last day of last month.

So you delete those two lines (delete the date parameters from the report altogether, in fact) from your selection criteria editor, and replace it with this:
Code:
{My.Date} in LastFullMonth
When you go to schedule the report, you won't have to specify anything about dates. Whether you run the report on the 1st of July or the 15th, you'll always get the complete month of June's data.

Avoid the select expert if you can, and just go ahead and do all this in the selection criteria editor yourself. The select expert uses some "artistic licence" which you may not always expect.

There's information about LastFullMonth in your help files, but in this case, I think it's a much cleaner solution than using two parameters.

Naith
 
Gotcha!!!

Etienne Oosthuysen
Hertfordshire, England
 
Just one more thing:

When I ran the report using my ?StartDate and ?EndDate parameters I could add this to the report header to show the viewer which period the report was for. Do you think there is a way of translating this new way of auto pass previous month parameter into some sort of description in the report header?

EO

Etienne Oosthuysen
Hertfordshire, England
 
create formulas"

//@Start
minimum(lastfullmonth)

//@End
maximum(lastfullmonth)

Use those formulas like you did your parameters.

Lisa
 
Thanks worked a treat thanks

Etienne Oosthuysen
Hertfordshire, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top