Skip to Content
author's profile photo Former Member
Former Member

How to schedule month/years

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on May 13, 2014 at 11:19 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.