Selecting Records in Crystal Reports 2013
Selecting Records Using Report Fields
You can use the “Select Expert” within Crystal Reports 2013 to create and apply filters to the report data to asset you in selecting records. When you create and apply report filters, you in some way specify which records to include and exclude for the report. Unless you wish to display every single record from the underlying table or tables that you selected when you created the report, you must apply filters to restrict the data displayed by selecting records you want to view in the report.
Crystal Reports uses the “Select Expert” dialog box to aid you in selecting records by specifying the filtering criteria applied to a report. One way to use this tool for selecting records is to first ensure that you do not have any data fields selected in your report, then click the “Select Expert” button that appears in the Experts toolbar. Beginning the process this way will display the “Choose Field” dialog box, first. You can select either a field from the report or a field from the underlying tables, even if not displayed in the report, from the list.
In the “Choose Field” dialog box, you can click the name of the field by which you want to apply a criteria restriction from the list of fields displayed in the dialog box. Once you have clicked on the name of the field by which you want to apply the filter in the “Choose Field” dialog box, you can then click “OK” to finally display the “Select Expert” dialog box.
The other way to launch the “Select Expert” dialog box to assist you in selecting records is to simply click the name of the field in the “Details” section of the report in “Design” view to which you want to apply a filter, first. Then click the “Select Expert” button in the Experts toolbar to launch the “Select Expert” dialog box.
Filtering Data Fields in the Select Expert Dialog Box
The “Select Expert” dialog box allows you to apply filtering conditions to the field that you initially selected to help you in selecting records in the report. You will see the name of the field you selected displayed as a tab at the top of the “Select Expert” dialog box. Use the drop-down that appears on this tab to select the comparison operator by which you want to compare the value of this field to a criteria value, which you will then specify. The text box where you can specify or select from a value contained within the field will only appear after a comparison operator has been selected. Note that the number of criteria text boxes that appear will also depend of the specific comparison operator selected. In these text boxes, you may have drop-down arrows appear upon which you can click to choose from a value in the selected field. The drop-down will only display the first 500 values in a field, so you can also directly type the data into the fields displayed, if needed. These values are used for selecting records in the report fields.
Following is a listing of the various types of comparison operations you can use for selecting records in Crystal Reports 2013. They are available for selection within each drop-down that appears on the selected field’s tab in the “Select Expert” dialog box.
Filtering Criteria in the Select Expert Dialog Box
Operator: | Filters: |
is any value | This condition specifies that there is no filter being applied. All records are displayed. This is the default comparison operator. |
is equal to | This operator will only display records that exactly match the value you specify. |
is not equal to | This operator displays all records that are not an exact match to the specified value. |
is one of | This operator displays all records that exactly match a list of values specified. |
is not one of | This operator display all records that are not an exact match of any values specified. |
is less than | This operator displays all records with a value less than the value specified. |
is less than or equal to | This operator displays all records with a value less than or equal to the value specified. |
is greater than | This operator displays all records with a value greater than the value specified. |
is greater than or equal to | This operator displays all records with a value greater than or equal to the value specified. |
is between | This operator displays all records with a value between the two values specified. |
is not between | This operator displays all records with a value that is not between the two values specified. |
starts with | This operator displays all records that have the same initial characters specified. |
does not start with | This operator displays all records that do not have the same initial characters specified. |
is like | This operator displays all records that match the character pattern specified. You establish the pattern using the wildcard characters of the question mark and/or the asterisk. |
is not like | This operator displays all records that do not match the character pattern specified. You establish the pattern using the wildcard characters available. |
is in the period | This operator displays all records that have a date/time value that falls within the date/time period specified. |
is not in the period | This operator displays all records that have a date/time value that does not fall within the date/time period specified. |
is True | This operator displays all records where the logical (Boolean) value is true. |
is False | This operator displays all records where the logical (Boolean) value is false. |
formula: | Used for selecting all records that match the result of a formula that you specify. |
Selecting Records Using the Comparison Criteria Specified
To finish selecting records in the report, you must specify the comparison criteria. Once you have chosen the desired comparison operator by which you want to filter the selected field, you can then enter or type the desired value against which to compare the field into the boxes which appear to the right of the selected comparison operator. For logical (Boolean) values, simply selecting the comparison operator is enough.
For the comparison operators “is like” and “is not like,” you must create the pattern against which to match the selected field’s values. You use the traditional DOS wildcard characters to establish this pattern. Wildcard characters are symbol characters that represent “unknown” values within a field. The question mark symbol (?) represents one unknown character in a field. The asterisk symbol (*) represents multiple unknown characters in a field. These values are useful for selecting records with unknown character values.
For example, entering the “like” operator followed by a criteria of “T??” would return records with a field value of three characters that begin with the letter “t,” like “Tim,” “Tom,” “the” and others. As another example, entering the “like” condition followed by the criteria of “T*” would return records with a field value that simply begins with a “t,” like “Thomas,” “T-bird,” “Thunder” and any other words that begin with the letter “t,” regardless of their character length.
After you have set the desired criteria, you may click the “OK” button to apply the filter. Then when you click the “Preview” tab, you may be prompted to refresh the data to apply the new filter. Click the “Refresh Data” button to refresh the report data displayed in the “Preview” tab. If you have not yet previewed the report data, then the filter will be used to create the new “Preview” tab that appears.
Video Lesson- “6.1- The Select Expert”
Below is a video training lesson taken from the tutorial “Mastering Crystal Reports Made Easy v. 2013-2011” by TeachUcomp, Inc. This video corresponds to the text within this blog and visually demonstrates selecting records by using the “Select Expert” dialog box in Crystal Reports 2013.