DIAdem Help

Method: Add for DirectAccessChannels

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

Method: Add for DirectAccessChannels

Adds an object to the Channels collection of a StringBlock, FixedWidthBlock, or a BinaryBlock and returns a DirectAccessChannel object.

Set oDirectAccessChannel = Object.Add(Name, DataType)

ObjectDirectAccessChannels
Object with this method
NameString
Specifies the name of the channel.
DataType Specifies the data type of the channel.
Enumeration with the following selection terms:
eI8 8-bit integer values
2 eI16 16-bit integer values
3 eI32 32-bit integer values
4 eI64 64-bit integer values
5 eByte Byte
6 eU16 16-bit unsigned integer
7 eU32 32-bit unsigned integer
8 eU64 64-bit unsigned integer
9 eR32 32-bit real values
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 shows the instructions required for reading the lines listed below:

12.06.2004; 1.345213.06.2004; 1.783414.06.2004; 2.003415.06.2004; 1.999616.06.2004; 1.564917.06.2004; 1.8957

These instructions transfer the data from the text file to a StringBlock. The data is interpreted as the values of two channels. The script can access these data with DirectAccess channels.

File.Formatter.TrimCharacters = " "
File.Formatter.LineFeeds  = vbNewLine
File.Formatter.TimeFormat = "DD.MM.YYYY"
File.Formatter.Delimiters = ";"
File.Formatter.Decimalpoint = "."

Dim oMyGrp : Set oMyGrp = Root.ChannelGroups.Add("MyChannelGroup") 
Dim oBlock : Set oBlock = File.GetStringBlock()
Dim oChn1  : Set oChn1  = oBlock.Channels.Add("Time", eTime)
Call oMyGrp.Channels.AddDirectAccessChannel(oChn1)
Dim oChn2  : Set oChn2  = oBlock.Channels.Add("YShift", eR64)
Call oMyGrp.Channels.AddDirectAccessChannel(oChn2)

Log in to get a better experience