Rockwell Automation FactoryTalk Historian Classic User Guide User Manual
Page 139

Creating RSBizWare Custom Analysis Tools Chapter 7
carriage returns and line continuation characters were added to this
code for readability.)
Private Sub RSBizWareCalculator_Calculate( _
ByVal xInArray As Variant, _
ByVal yMinInArray As Variant, _
ByVal yMaxInArray As Variant, _
ByVal CountInArray As Variant, _
xOutArray As Variant, _
yOutArray As Variant)
End Sub
The only real difference from the IDL code is that Visual Basic
converted the generic [in] and [in, out] IDL keywords into the
ByVal
and
ByRef
syntax that Visual Basic uses. (The
ByRef
keyword
is the default if neither
ByVal
nor
ByRef
is specified.)
The purpose of the analysis tool is to compute the negative value of
each Y-axis value that was passed into the function. To do this the
program must loop through each value passed in and create a
corresponding output value that is the same numeric value except
with the sign changed (for example, you'll be turning the value 5.3
into -5.3).
To complete the
Calculate()
function, do the following by adding
the specified code to the function:
1. Determine the size of the output array. The Configuration
Console does not assume that the output array will be the
same size as the input array. In this case, the program will
return X and Y arrays of the same size, but the program must
still allocate the arrays in the Calculate() function as follows:
' In this calculator, we will return the same size of array
' as was passed in
ReDim xOutArray(0 To UBound(yMinInArray)) As Double
ReDim yOutArray(0 To UBound(yMinInArray)) As Double
The Visual Basic
Ubound()
function returns the upper bound
of the passed in array.
Rockwell Automation Publication HIST-UM001K-EN-E-June 2014
139