Method: Add for DirectAccessChannels
- Updated2024-09-12
- 2 minute(s) read
DataPlugin > Methods > Method: Add for DirectAccessChannels
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)
| Object | DirectAccessChannels Object with this method | |||||||||||||||||||||||||||||||||||||||
| Name | String Specifies the name of the channel. | |||||||||||||||||||||||||||||||||||||||
| DataType | Specifies the data type of the channel. Enumeration with the following selection terms:
| |||||||||||||||||||||||||||||||||||||||
| oDirectAccessChannel | DirectAccessChannel 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.3452¶ 13.06.2004; 1.7834¶ 14.06.2004; 2.0034¶ 15.06.2004; 1.9996¶ 16.06.2004; 1.5649¶ 17.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)