DIAdem Help

Method: GetChannels for Data

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

Method: GetChannels for Data

Returns a collection of channels in the script interface for internal data. DIAdem sorts the result list in ascending channel number order. Use the GetChannels method to create data objects from channel references, for example, from layout configurations, and then to continue processing the data using the script interface for internal data.

Set oElementList = Object.GetChannels(Reference)
ObjectData
Object with this method
ReferenceVariant
Specifies which channels are in the list that the method returns. You use the group or channel index to specify channels, or use conditions to include only specific channels of a channel group in the list. If DIAdem cannot interpret the specified channel list completely, the list returned by the GetChannels method is empty.
 "[Index]"
Specifies the indexes of the group and the channel. Specify the indexes as follows: "[Group index]/[Channel index]". The expression Data.GetChannels("[1]/[2]"), for example, returns the second channel of the first channel group. If you want to select a channel from the default group, use empty, square brackets, for example, "[]/Time” for the group.
 "Identifier"
Specifies an expression with the identifier for the group or channel name as "Example/Time". Use a question mark (?) as a wildcard for one character, and an asterisk (*) as a wildcard for any number of characters. The expression Data.GetChannels("Example/D*"), for example, returns all channels whose names start with the letter D from the channel group Example.
If the identifiers do not meet the name conventions for channels, DIAdem replaces the invalid characters with valid characters.
oElementListElementList <Data>
Returned object
Note  Execute the ChnRenumber command before using the GetChannels method, in order to align the channel sequence in the list with the channel sequence in the structure view. The GetChannels method always returns the list of channels in the global channel number sequence of DIAdem.

The following example displays all channels that start with T from the Examples channel group.

VBScriptPython

 

Dim oMyChannels, oMyChn, sOutput
Call Data.Root.Clear()
Call DataFileLoad("Weather.tdm")
Set oMyChannels = Data.GetChannels("Weather/T*")
For Each oMyChn in oMyChannels
  sOutput = sOutput & vbCrLf & oMyChn.Name
Next
MsgBox "Channel names: " & sOutput

Log in to get a better experience