Tuesday, October 18, 2016

Automating Crystal Reports With Parameters



The ability to automate Crystal Reports with parameters is a standard feature in all third-party Crystal Reports Schedulers. But, more often than not, you will be looking for the ability handle range values, nulls, calculated values and calculated dates as part of the process. You will also want to easily set independent parameters for sub-reports.

Using CRD to automate parametrized Crystal reports


Automating Crystal Reports With Parameters | Crystal Reports Scheduler


In this post, I will discuss how to use CRD to schedule parameterized reports.  CRD® (Crystal Reports Distributor) is a Crystal Reports Scheduler that saves time and money by making it easy to automate Crystal reports. Crystal Reports scheduling is easy. Just define single or packages of Crystal Reports®, schedule, run them automatically and send the reports to print, fax, folder, FTP, SMS, DropBox, Sharepoint & email in a number of standard formats including Excel, Word, PDF, RPT and more.

Setting Discrete & Range Parameters


CRD handles parameters in the "Report" section of the wizard - when creating new schedules - and the properties of an already existing Crystal Reports schedule.

Crystal Reports Parameters | Crystal Reports Scheduler | CRD


There are 3 requirements in order for CRD to detect your Crystal Report parameters and their parameter values:


  1. The parameter must be in use in the report
  2. The parameter must be visible
  3. The parameter must be set to be prompted at run time


If these three requirements are achieved, you should see the parameters in your report listed in this screen.

Crystal Reports Discrete Parameter | Crystal Reports Automation | CRD


For each parameter, select from the drop down list the value the report must use. In a discrete parameter, only one parameter value can be run at a time per parameter. You can type a value into the field as well. Select "Set as Null" if you want the parameter to use no value at run time.  Select "Ignore" if you want the parameter to be ignored at run time.

Range Parameters work in a similar fashion.

Crystal Reports Range Parameters | Automate Crystal Reports | CRD


Handling Date Parameters


If your report contains a date parameter, you can either manually enter dates, or select the desired date from the built-in calendar. Simply click in the date parameter field to open the calendar. Select the desired date. Click OK. If the parameter is also a time parameter, you can select this as well.

To enable a report parameter to run for a date constant (Current Date, Yesterday etc.), select CRD Constants from the inserts window, then drag and drop your desired constant to the parameter field.

Crystal Reports Calculated Dates

The constants can be modified further before dragging and dropping.  For example current date - 1, Current Month - 1, Current Year - 365, Current date + 7, and so on.

Setting Up Subreports


You can access subreports by right-clicking on each subreport and exposing the settings for that subreport.

Crystal Reports Subreports | Crystal Reports Scheduler | CRD



Click to Download a Free 30-Day Full-Feature trial of CRD.



Learn More About CRD


No comments: