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

Crystal Reports Dynamic Scheduling

Problem Statement:

Currently, user has the ability to schedule Crystal Reports by applying the “From” and “To” date values for the input parameters. But this does not help because customer wants to set up a report to run monthly in Crystal Reports to retrieve the last month data.

There is a limitation with the existing scheduling system that, the report will run only for the date range mentioned in the parameters. Thus, currently there is no difference between the view mode and scheduling mode except in the mode of running – foreground or background.

The user would prefer more reasonable date type intervals while running the report in the scheduling mode such as Date Range, Last 30 Days, Last 7 Days, Last Month, Last Quarter, Last Week, Yesterday etc., which the existing system currently doesn’t support.

Expectation:

Is there a way to hide/remove the “From“ and “To” date parameters when user selects other than “Date Range” as input in Date Type Interval parameter.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 18, 2016 at 06:53 AM

    Hi Rakesh,

    The base report was designed to pull data for a specific date range using From and To dates. You can very well remove this condition but before you remove implement new criteria ( Last 30 Days, Last 7 Days, Last Month, Last Quarter, Last Week, Yesterday) so that report will filter data and display. Otherwise report will retrieve entire data by including other report filters.

    Logic to Implement new requirement is :

    Create a parameter with ( Last 30 Days, Last 7 Days, Last Month, Last Quarter, Last Week, Yesterday) as static values, it should be string parameter and accepts single value.

    Now write below code to run report for selected option :

    If {?DateRang} = 'Last 30 days' Then

    {DatabaseDateField} >= dateadd('d',-30, currentdate) and {DatabaseDateField} <= Currentdate

    Else

    If {?DateRang} = 'Last 7 days' Then

    {DatabaseDateField} >= dateadd('d',-7, currentdate) and {DatabaseDateField} <= Currentdate

    Else

    If {?DateRang} = 'Last Month' Then {DatabaseDateField} in LastFullMonth

    Else

    If {?DateRang} = 'Last Week' Then {DatabaseDateField} in LastFullWeek

    Else

    If {?DateRang} = 'Yesterday' Then {DatabaseDateField} = currentdate -1


    Place this formula in your record selection to filter records as per parameter selection.


    Thanks,

    Sastry

    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.