DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I check the unit of a channel in Diadem 2017 Script?

Hi All

 

In my code I did : in Diadem 2017

Function ChannelIsTime(groupIndex, channelName)
Dim chnIndex
ChannelIsTime = False
For chnIndex = 1 To Data.Root.ChannelGroups(groupIndex).Channels.Count
If Data.Root.ChannelGroups(groupIndex).Channels(chnIndex).Name = channelName Then
' Check if the channel is of the type "Time"
If Data.GetChannelProperties(Data.Root.ChannelGroups(groupIndex).Channels(chnIndex)).Item("Unit").Value = "s" Then
ChannelIsTime = True
Exit For
End If
End If
Next
End Function

 

in order to check if the unit of a channel is time, in order to find out which one is the time channel. but I get an error that this method doe snot exist. what is the right way?

0 Kudos
Message 1 of 2
(303 Views)

To access the channel unit use Data.Root.ChannelGroups(1).Channels(channelName).UnitSymbol.

 

To create the correct syntax you can simply drag the unit property tag from data portal into your script.

DIAdem experience since 1996

Turn-key applications - Remote and on-site trainings - On-the-job training

| müller+krahmer GmbH | Koenitzer Straße 14, 07338 Kaulsdorf / Germany |
| Phone: +49 36733 / 2328 - 6 | Mobile: +49 160 / 287 7294 |
| Email: mueller@mueller-krahmer.de | Web: www.mueller-krahmer.de |
0 Kudos
Message 2 of 2
(234 Views)