Main Body
Query(s)
SELECT
Orders.[Order ID]
,Orders.[Order Amount]
,Orders.[Order Date]
,Orders.[Ship Date]
FROM
Orders
WHERE
-- This record selection formula demonstrates the use of a custom function to create a flexible record
-- selection formula that is pushed down to the database server.
--
-- The user supplies a reference order date parameter, {?reference date} and a range condition,
-- {?reference condition} to indicate a range of dates around the reference order date. The report
-- is then previewed with only the records whose order dates fall in the specified range. Notice
-- that the SQL query has a Where clause and in fact, this entire record selection is performed on
-- the database server. This is because the custom function and all its arguments can be evaluated before
-- accessing the database. Writing this formula with an If/Then/Else would not let it be pushed down to
-- the database server. See the section on Advanced Record Selection Formulas in the Seagate Crystal
-- Reports manual for details as to why.
Orders.[Order Date] in cdSpecialDateRange({?reference date},{?reference condition})
ORDER BY
Orders.[Order Date] ASC