Create a User-Defined Function

About this task

This topic describes how to create your own function to use in a calculation formula. You can also use any of the built-in functions.

Before you begin

Create the tag that you want to use to store the calculation results. You can create the tag manually using Historian Administrator or the Web Admin console. Or, you can copy a tag using Historian Administrator or the Web Admin console.

Procedure

  1. In Historian Administrator, select Tags, select the tag for which you want to create a calculation formula, and then select Calculation.
  2. In the Calculation section, remove Null (retain Result =).
    Tip: Avoid selecting other tags until you save your changes or you will lose your code changes.
  3. Select Functions.
    The User Defined Functions window appears.
  4. Select New.
    The Edit Function window appears.
  5. Define the function.
    You can build formulas using the wizard, or create it manually by entering functions in the Edit Function box. For information, refer to User-Defined Functions.
  6. Select Syntax to check for errors.
  7. Select Update.
    Your function appears in the list, and is available for use in other calculations as well.
  8. To use the function, select Insert Function.
    The function is inserted in your calculation formula.