This topic describes how to create your own function to use in a calculation formula. For more information, refer to User-Defined Functions. You can also use any of the built-in functions.
In the NAVIGATION section, under the Configuration Hub plugin for Historian, select Tags.
A list of tags appears.
Select a calculation tag, right-click or select more options, and then
select Calculation.
The calculation editor appears.
In the CALCULATION section, remove
Null (retain Result =).
In the calculation editor, place the cursor in the location where you want to insert the user-defined function.
In the DETAILS section, under User Defined Functions, select .
The Add/Edit User Defined Functions (UDF) window appears.
Select Add New.
A function is created with the following naming convention: UserFunction<number>. The same function is used in the function editor. You can change the function name by entering the new name in the function editor and selecting Update UDF.
Enter the VB script for the function. Or, if you want to use a pre-built function, select the function type and function in the respective fields under Pre-Built Functions. And, enter values in the other fields that appear after selecting a function.
The function appears in the function preview below the function editor.
Select Insert Preview.
The function is included in the function editor at the cursor position.
To test the function syntax, select .
A message appears, stating whether the function syntax is correct.
Select Update UDF.
The user-defined function is created.
To use the function in the calculation formula, select Insert UDF.
The function is inserted in the calculation formula at the cursor position.
To test the calculation formula, select .
A message appears, stating whether the syntax is correct.
In the upper-left corner of the page, select Save.
The calculation formula is created.
To create a user-defined function using Historian Administrator:
In Historian Administrator, select Tags, select the tag for which you want to create a calculation formula, and then select Calculation.
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.
Select Functions.
The User Defined Functions window appears.
Select New.
The Edit Function window appears.
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.
Select Syntax to check for errors.
Select Update.
Your function appears in the list, and is available for use in other calculations as well.
To use the function, select Insert Function.
The function is inserted in your calculation formula.