Method: CreateElementList for Data
- Updated2024-09-12
- 1 minute(s) read
Internal Data > Methods > Method: CreateElementList for Data
Method: CreateElementList for Data
Generates in the script interface for internal data a collection of elements. Every element from the generated collection is an Element and thus can be a root type (eDataRoot), a channel group type (eDataChannelgroup), or a channel type (eDataChannel).
Set oElementList = Object.CreateElementList()
| Object | Data Object with this method |
| oElementList | ElementList <Data> Returned object |
The following example adds all channel groups and channels of the Data Portal into a list of elements and returns the number of elements contained in this list:
| VBScript | Python |
Dim oMyElementList, oMyChannelgroups, Channelgroup, oMyChannels, Channel Set oMyElementList = Data.CreateElementList Set oMyChannelgroups = Data.Root.ChannelGroups For Each Channelgroup in oMyChannelgroups Call oMyElementList.Add(Channelgroup) Set oMyChannels = Channelgroup.Channels For Each Channel in oMyChannels Call oMyElementList.Add(Channel) Next Next Call MsgBoxDisp(oMyElementList.Count)