DIAdem Help

Method: Add for DirectCellChannels

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

Method: Add for DirectCellChannels

Adds an object to the DirectCellChannels collection of a CellBlock and returns a DirectAccessChannel object.

Set oDirectAccessChannel = Object.Add(Name, [DataType])
ObjectDirectCellChannels
Object with this method
NameString
Specifies the name of the channel.
[DataType]Specifies the data type of the channel.
If you do not specify the data type, the first cell of the channel automatically determines the data type.
Enumeration with the following selection terms:
3 eI32 32-bit integer values
8 eU64 64-bit unsigned integer
10 eR64 64-bit real values
23 eString Text
24 eEnum Enumeration
30 eTime Time values
oDirectAccessChannelDirectAccessChannel
Returned object
Note  The channel name must be unique.

The following example reads in the values of the worksheet columnwise from the second row of the first column and saves the values in channels of the first channel group:

Dim oCurrSheet
Set oCurrSheet = Workbook.Sheets(1)
Dim oCellBlock
Set oCellBlock = oCurrSheet.GetCellBlock(2,1)

Dim i, Name, oNewChannel
For i = 1 to oCurrSheet.MaxPosition.Column
  Name = oCurrSheet.GetCellValue(1,i)
  Set oNewChannel = oCellBlock.Channels.Add(Name) 
  Call Root.ChannelGroups(1).Channels.AddDirectAccessChannel(oNewChannel)
Next

Log in to get a better experience