CimPairData.Set (method)

Sets a pair of X and Y single or array values starting at a specified index in the X and Y data value vectors.
Syntax: object.Set AtIndex, XData, YData
Parameters:
AtIndex As long - Specifies the index to start setting values.
XData As VARIANT* - Specifies the X value. This value can be a single variable or array value of any of the following types, as long as it results in a numeric value:
7 Integer
7 Long
7 Single
7 Double
7 Decimal
7 Boolean
7 Byte
7 Variant
7 String
YData As VARIANT* - Specifies the Y value. This value can be a single variable or array value of any of the following types, as long as it results in a numeric value:
7 Integer
7 Long
7 Single
7 Double
7 Decimal
7 Boolean
7 Byte
7 Variant
7 String
Description: CimPairData.Set Set allows you to set one or more X and Y data values starting at a specified index. The index is a number from 0 to Count minus 1.

Example on setting data values

You have a series whose X and Y values are the following:

X 5 10 15 20 25 30
Y 22 17 9 -7 22 41

You set the following X and Y values starting at location 2 (index 1):

X 35 40 45 50
Y 59 37 21 6

The series X and Y values are now the following:

X 5 35 40 45 50 30
Y 22 59 37 21 6 41

The XY values at locations 2 through 5 are updated with the new values.

Script Examples

The following CimView script excerpt sets the fifth location (index 4) in Series 1. The X is set to an integer and the Y to a double value:

' Create an integer and a double value:
Dim x as Integer
x = 7
Dim y as Double
y = 22.74
' Set the data in the series object:
cimOleObj.Series("Series 1").Data.Set 4, x, y

The following CimView script excerpt creates an array of variant values and an array of double values in Series 1. In addition, it sets the X and Y elements starting with the fifth element (index 4) through the ninth. (It goes all the way through the ninth element because the arrays being used have five elements.):

' Create an array of variant values:
Dim x(4) As Variant
x(0) = 1
x(1) = Null
x(2) = 4.78
x(3) = Empty
x(4) = "5.78"
' Create an array of random double values:
Randomize
Dim y(4) As Double
For i = 0 To 4
    y(i) = Random(0, 50)
Next i
' Set the data in the series object:
cimOleObj.Series("Series 1").Data.Set 4, x, y

Setting Values from Points

CimEdit Scripts provide you with a type called Point. Point can be used to set and get CIMPLICITY point management information. For single (1 element) points you can use GetValue or a combination of Get and Value to get a single value and set it in a series. For array points you can use GetSafeArray or a combination of Get and SafeArray to get a single value and set it in a series.

Script Examples

The following CimView script excerpt sets the first location (index 0) in Series 1. The values of two CIMPLICITY points are used:

' Get two point values:
Dim x As New Point
x.Id = "X_POINT"
Dim y As New Point
y.Id = "Y_POINT"
' Set the data in the series object:
cimOleObj.Series("Series 1").Data.Set 0, x.GetValue, y.GetValue

The following CimView script excerpt sets Series 1 with array values of two CIMPLICITY HMI points. The set starts at the first location up to the smaller of either the size of the array points or the number of available locations in the series.:

' Get two point values:
Dim x As New Point
x.Id = "X_ARRAY_POINT"
Dim y As New Point
y.Id = "Y_ARRAY_POINT"
' Get the series object:
Dim series as CimSeries
Set series = cimOleObj.Series("Series 1")
' Set the array data in the series object:
series.Data.Set 0, x.GetSafeArray, y.GetSafeArray