DIAdem Help

Method: Add for Channels <Data>

  • Updated2024-09-12
  • 1 minute(s) read

Method: Add for Channels <Data>

Creates a new channel in the script interface for internal data and adds the channel to the Channels collection. The Add method returns a Channel object.

Set oChannel = Object.Add(Name, DataType, [DestIndex])
ObjectChannels <Data>
Object with this method
NameString
Specifies the name of the channel. The name must conform to the DIAdem naming conventions for channels. If the name does not conform to the name conventions, DIAdem corrects the name.
DataTypeSpecifies the data type of the channel.
Enumeration with the following selection terms:
10 DataTypeChnFloat64 64-bit real values
23 DataTypeChnString Text
30 DataTypeChnDate Time values
[DestIndex]LongInteger
Specifies the position of the new channel in the collection of existing channels. If you do not specify the DestIndex parameter, DIAdem creates the new channel at the end of the collection.
oChannelChannel <Data>
Returned object

The following example generates the DataTypeFloat64 data type channel MyChn in the MyChnGrp channel group.

VBScriptPython

 

Dim oGroupChns, oMyChn
Set oGroupChns = Data.Root.ChannelGroups(1).Channels

If not oGroupChns.Exists("MyChnName") Then
  Set oMyChn = oGroupChns.Add("MyChnName",DataTypeChnFloat64)
Else
  Set oMyChn = oGroupChns("MyChnName")
End If

Log in to get a better experience