Method: Add for Channels <Data>
- Updated2024-09-12
- 1 minute(s) read
Internal Data > Methods > Method: Add for Channels <Data>
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])
| Object | Channels <Data> Object with this method | |||||||||
| Name | String 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. |
|||||||||
| DataType | Specifies the data type of the channel. Enumeration with the following selection terms:
| |||||||||
| [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. |
|||||||||
| oChannel | Channel <Data> Returned object |
The following example generates the DataTypeFloat64 data type channel MyChn in the MyChnGrp channel group.
| VBScript | Python |
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