Create Record Selection Formula

<< Click to Display Table of Contents >>

Navigation:  Introduction to Crystal Reports > Upgrading Existing Reports to include ProjectID >

Create Record Selection Formula

Introduction to Crystal Reports > Upgrading Existing Reports to Include ProjectID

Now we are ready to create the data filter. We want to create a filter that selects only data with ProjectID equal to the current project name.

Filtering of data is done by creating a Record Selection formula. On the Report menu, choose Selection Formulas and then Record… Now the Formula Workshop window opens.

In the Report Fields list, expand the database and the appropriate database table, in this case the item table. Select the database field ProjectID with the mouse, and drag it into the formula text window.

image56_359

In the formula text window, type the sign of equality after {ITEM.ProjectID}.

Next, expand the Report Fields branch. Locate the parameter named ProjectID. Drag and drop it to the formula text window. Parameter fields are marked with a question mark icon in the list.

image56_360

The selection formula should look like this:

{ITEM.ProjectID}={?ProjectID}

Click the Save and close button.

To view the effect of the filter, preview the report in the Crystal Reports designer. Select Print preview on the View menu.

Now a prompting window appears, asking you to enter ProjectID. Select a ProjectID from the dropdown list and click OK.

Please note that users of Crystal Reports version 10 and earlier will not be able to display the available ProjectIDs in a dropdown list. The ProjectID must then be entered manually.

image56_361

If there are no sub-reports in your report, you can save and close the report.