Performing Calculations Using Named Event Rules

Access the appropriate project in OMW.

  1. Add a business function to the same project in which you added the other smart field components.

  2. On the Add Object form, create a new business function, naming it according to the recommended naming conventions.

  3. Under Source Language, select NER and then click OK.

  4. On the Design Tools tab of the Business Function Design form, click Start Business Function Design Aid.

  5. 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.

  6. 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.

  7. Enter a description in the Description field.

    This description can be the same as the name, however, you can use spaces in the description.

  8. Tab through the remaining fields.

    The system populates the F3 Code field with a 3 (Minor Business Rule).

  9. Modify the F3 Code if appropriate.

  10. Click the row header to highlight the row of data that you just entered, and select Parameters from the Row menu.

  11. Use the QBE line to locate the associated data structure, click the data structure and then click Select.

  12. 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.

  13. From the Form menu, select Edit.

  14. 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.
  15. When the logic is complete, save the event rules and click OK.

  16. On the Design Tools tab, click Build Business Function.