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:

  1. Choose Calculations User Defined Function. If there are UDFs defined, the User Defined Functions dialog box appears.
  2. Choose New to create a new UDF. The New User Defined Function dialog box appears.
  3. If there are no UDFs defined, the New User Defined Function dialog box appears immediately.

  4. Type IS-WEEKEND in the User Defined Function Name fill-in field.
  5. Type the following expression:
  6. (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.

  7. Choose the New button to create the Any-Date parameter. The New Parameter dialog box appears.
  8. Type Any-Date in the Parameter Name fill-in field.
  9. Select Date as the parameter type, then choose OK. Report Builder returns you to the New User Defined Function dialog box.
  10. Choose Verify to check the expression syntax. If you entered it correctly, Report Builder displays a confirmation dialog box.
  11. Choose OK to create the function and return to the User Defined Function dialog box.
  12. 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