Progress
Report Builder
User’s Guide
Determining Whether a Date Falls on a Weekend
You can easily create a UDF to determine whether a date falls on a weekend.
Follow these steps to create the IS-WEEKEND user-defined parameter:
- Choose Calculations
User Defined Function. If there are UDFs defined, the User Defined Functions dialog box appears.
- Choose New to create a new UDF. The New User Defined Function dialog box appears.
If there are no UDFs defined, the New User Defined Function dialog box appears immediately.
- Type IS-WEEKEND in the User Defined Function Name fill-in field.
- Type the following expression:
(WEEKDAY(Any-Date) = 7) OR (WEEKDAY(Any-Date) = 1)
This expression uses the built-in WEEKDAY( ) function, a relational operator (=), and a logical operator (OR) to operate on a date expression represented by the parameter name Any-Date. The WEEKDAY( ) function returns a number from 1 to 7 that represents the day of the week of the Any-Date expression. The = operator tests whether this number is 7 (Saturday) or 1 (Sunday). The OR operator means that if the number of the day is either 7 or 1, the expression is true, which means that the date falls on a weekend.
Now you must create the parameter to pass the date information to the expression.
- Choose the New button to create the Any-Date parameter. The New Parameter dialog box appears.
- Type Any-Date in the Parameter Name fill-in field.
- Select Date as the parameter type, then choose OK. Report Builder returns you to the New User Defined Function dialog box.
- Choose Verify to check the expression syntax. If you entered it correctly, Report Builder displays a confirmation dialog box.
- Choose OK to create the function and return to the User Defined Function dialog box.
- Choose Close to return to the report layout.
You can create a calculated field consisting of the following expression to display whether the current system date is a Saturday or a Sunday:
IS-WEEKEND(TODAY())
In this expression, the TODAY( ) function supplies a date value for the expression to process.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |