Specifying a Time Range

You have the ability to run a report within a time range by selecting DateTime or entering DateTime in format of “mm/dd/yyyy hh:mm:ss”.

You can specify a time range for a report by completing the following tasks:

  1. Rename the Start Date parameter
  2. Modify formulas
  3. Run a customized report

Rename the Start Date parameter

  1. Open a report to be customized using Crystal Reports. The Design page opens.
  2. From the View menu, click Field Explorer. The Field Explorer panel opens.
  3. Expand Parameter Fields, right-click Start Date and select Rename.
  4. Type Period as the new name for the parameter.
  5. Double-click Period. The Edit Parameter window opens.
  6. Select Static from the List of Values drop-down menu.
  7. In the Value Options section, locate “Allow range values”, and then select True.
  8. Click OK.

Modify formulas

  1. From the Report menu, click Formula Workshop. The Formula Workshop window opens.
  2. Expand Selection Formulas, and then click Record Selection. The Formula Editor window opens.
  3. Replace all the >= {?Period} with in {?Period} in the editor area as shown below.

    Note

    • Click Check on the toolbar to look for any possible errors in the code. You must fix all errors to proceed.
    • Use the search and replace feature to change all instances of >= {?Period} in the editor area.

  4. Click Save.
  5. Expand Formula Fields and click Date Range. The Formula Editor window opens.
  6. In the editor area, replace ToText({?Period},"MM/dd/yyyy")+ " to " +ToText(CurrentDateTime,"MM/dd/yyyy") with ToText(Minimum({?Period}),"MM/dd/yyyy")+ " to " +ToText(Maximum({?Period}),"MM/dd/yyyy").

  7. Click Save and close. The Formula Editor window closes.
  8. Click Save on the Standard toolbar to save all modifications that you have made.

Run a customized report

  1. Start the legacy listener. See Start the legacy listener.
  2. Click Print Preview on the Standard toolbar. The Enter Values window opens.
  3. Select the date range by doing one of the following:

    1. Enter dates in the "mm/dd/yyyy hh:mm:ss" format in the text box provided.
    2. Click the calendar icon and select a date.
  4. Click OK to run the report.