CimData.Set (method)

Sets a single or array values starting at a specified index in the data value vector.
Syntax: object.Set AtIndex, Data
Parameters:
AtIndex As long - Specifies the index to start setting values.
Data As VARIANT* - Specifies the 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: CimData.Set Set allows you to set one or more data values starting at a specified index. The index is a number from 0 to Count minus 1. This method is similar to CimPairData.Set. It differs in that it sets the data in the X or the Y vector individually.

Example on setting data values

You have the following data values:

5 10 15 20 25 30
You set the following data values starting at location 2 (index 1):

35 40 45 50
The data values are now the following:

5 35 40 45 50 30
The 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
' Get the series object:
Dim series as CimSeries
Set series = cimOleObj.Series("Series 1")
' Set the data in the series object:
series.Data.X.Set 4, x
series.Data.Y.Set 4, 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
' Get the series object:
Dim series as CimSeries
Set series = cimOleObj.Series("Series 1")
' Set the data in the series object:
series.Data.X.Set 4, x
series.Data.Y.Set 4, 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"
' Get the series object:
Dim series as CimSeries
Set series = cimOleObj.Series("Series 1")
' Set the data in the series object:
series.Data.X.Set 0, x.GetValue
series.Data.Y.Set 0, 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.X.Set 0, x.GetSafeArray
series.Data.Y.Set 0, y.GetSafeArray