on 05-13-2014 10:10 PM
I have a report that needs to run a few days after the previous month. How is the best way to do this?
The report has dates from and to but this can be changed to just month year.
The user wants to see data for the entire month and as well the previous year entire month.
1. the same report can run twice, with the year diff
2. can make 2 reports, one has the current year and last month
other has prev year and that month
how to calculate these?
Hi Paul,
Are you asking how to schedule the report to run or are you asking how to pass the last vs. previous year month?
If you want to pass the last and previous year month, there are two ways to do it:
1) build the report with a parameter that will allow your user to select which period they want. The parameter would be used in the RecordSelection Formula like:
DateVar myDate;
DateVar StartDate;
DateVar EndDate;
myDate := cDate(DateAdd ("m", -13, CurrentDate));
StartDate := Date (Year (myDate), Month (myDate), 1);
EndDate := Date (Year (myDate), Month (cDate (DateAdd ("m", 1, myDate))), 1) - 1;
Case {?rptPeriod}
"Last Month" :{table.DateField} in LastFullMonth
"Last Year" :{table.DateField} In [StartDate to EndDate];
The formula calculates the start and end dates for last year based on the current date - 13 months.
The Case statement looks at the parameter your use selects and uses the appropriate date range.
2) Create a report based on last month. Save and save a copy of the report and add it in as a subreport. The subreport you can pass a similar formula as above from the main to the sub report, without the need for a parameter.
This will give you a current vs. previous all in one report.
Thanks,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.