Performing Calculations Using Named Event Rules
Access the appropriate project in OMW.
Add a business function to the same project in which you added the other smart field components.
On the Add Object form, create a new business function, naming it according to the recommended naming conventions.
Under Source Language, select NER and then click OK.
On the Design Tools tab of the Business Function Design form, click Start Business Function Design Aid.
On the Business Function Design form, click the visual assist in the Parent DLL field and select the DLL that your company uses to create custom business functions.
In the detail area, enter a unique name in the Function Name field.
This name cannot include any spaces and should be descriptive of the business function purpose.
Enter a description in the Description field.
This description can be the same as the name, however, you can use spaces in the description.
Tab through the remaining fields.
The system populates the F3 Code field with a 3 (Minor Business Rule).
Modify the F3 Code if appropriate.
Click the row header to highlight the row of data that you just entered, and select Parameters from the Row menu.
Use the QBE line to locate the associated data structure, click the data structure and then click Select.
On the Business Function Design form, verify that the name of the appropriate data structure appears in the Template Name field in the detail area.
From the Form menu, select Edit.
On the Named Event Rules Design form, create the appropriate logic using If/While statements, assignments, business functions, and system functions.
For example, for the quarterly amount smart field that calculates sales for each quarter, this logic is appropriate:
If <user prompt> is equal to 2 <return value> = Sales for Period 4 + Sales for Period 5 + Sales for Period 6 Else If <user prompt> is equal to 3 <return value> = Sales for Period 7 + Sales for Period 8 + Sales for Period 9 Else If <user prompt> is equal to 4 <return value> = Sales for Period 10 + Sales for Period 11 + Sales for Period 12 Else <return value> = Sales for Period 1 + Sales for Period 2 + Sales for Period 3 End If End If End If
Note: The first quarter sales is the default result. Therefore, if the user enters a value other than 2, 3, or 4, the business function calculates sales for the first quarter.When the logic is complete, save the event rules and click OK.
On the Design Tools tab, click Build Business Function.