Operation Manual
Record Selection
Pushing down record selection to the database server
9
162 Crystal Reports User’s Guide
Selecting records using preset date ranges
The preset date ranges can be used to create selection formulas similar to
these:
{file.DATE} in LastFullMonth
Selects those records in which the date found in the {file.DATE} field
falls within the last full month. (If the month is May, this selects all
records with an April date.)
not({file.DATE} in LastFullMonth)
Selects all records except those in which the date found in the
{file.DATE} field falls within the last full month (if the month is May,
this selects all records except those with an April date).
Selecting records using date/number/character combinations
These formulas simply “mix and match” formulas from the categories above.
"C" in {file.FIELD}[1] and Month({file.DATE}) in [1,4]
Selects those records in which the value in the {file.FIELD} field
begins with “C” and the month is either January or April. For
example, if this kind of formula was used with an order database, you
could be asking for a report showing all customers whose names
begin with “C” and who placed orders in January or in April.
"AOK" in {file.HISTORY}[3 to 5] and {file.OPENCRED} >= 5000
Selects those records in which the {file.HISTORY} field shows the
characters “AOK” as the 3, 4, and 5 characters and the
{file.OPENCRED} field (the amount of available credit) is at least 5000.
These templates can be used as they are (with your own data), or they can be
combined to create complex formulas.
Pushing down record selection to the database
server
The drivers provided with Crystal Reports for SQL data sources allow “pushing
down” record selection to the database server. When you specify a record
selection formula in a report based on an SQL data source, Crystal Reports
analyzes it, generates a SQL query from it and passes the SQL query to the
database server. Record selection is then carried out in two stages:
• The first stage of record selection takes place when the database server
processes the SQL query and returns a set of records to Crystal Reports.
• In the second stage, Crystal Reports further evaluates locally the record
selection formula for the set of records returned from the database server.