Progress
Report Builder
User’s Guide
Calculating the Amount of Deposit
In this example you create a UDF to calculate how much money a customer must pay, based on the order amount.
Follow these steps to create the DEPOSIT user-defined function:
- Choose Calculations
User Defined Function. If there are UDFs defined, the User Defined Function 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 DEPOSIT in the User Defined Function Name fill-in field.
- Type the following expression:
IIF(Amount < 500, Amount * .10, Amount * .15)
This expression calculates the amount of the deposit based on whether the order amount is less than or greater than $500. If the order is less than $500, then the deposit is 10% of the order. If the order is greater than or equal to $500, then the deposit is 15%.
Because UDFs are not associated with specific reports, you cannot specify a database field name in the expression. You must create an amount parameter through which to pass the order amount.
- Choose the New button to create the Amount parameter. The New Parameter dialog box appears.
- Type Amount for the parameter name.
- Select Numeric as the parameter type, then choose OK. Report Builder returns you to the New User Defined Function dialog box.
- Choose OK to create the function and return to the User Defined Function dialog box. Report Builder automatically verifies the expression syntax.
- Choose Close to return to the report layout.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |