CHAPTER 10 MANAGING REPORTS
shared schedule, it is important that all the parameters for the report have default values. To begin with,
all eight parameters in the AR Reconciliation report are set to allow NULL values, as shown in Figure
10-2, which causes the default value of the parameter to be set to NULL when executed. This is OK
because the logic in the main stored procedure that uses the parameters knows to return all data when a
NULL value is passed to it.
Figure 10-2. AR Reconciliation report parameters
For the parameters AcctPeriodYear and AcctPeriodMonth, however, you need to add default non-
NULL parameter values so that the returned dataset includes only those records for the current
accounting period. To do this, you use two functions:
- DATEPART: Returns an integer representing one of the component parts of a date,
such as year, quarter, month, or day - TODAY: Returns the current date
Used together in an expression, these functions allow you to set the desired default values for your
two parameters. For AcctPeriodYear, you simply set the default value to the current year, as follows:
=DATEPART("yyyy", TODAY())
For AcctPeriodMonth, you essentially do the same thing, but you need to subtract 1 from the
expression value to return the data for the correct month. For example, the expression =DATEPART("m",