08-22-2017 01:46 PM
It appears that "ChV" is no longer supported in 2017. It still works in the script, but I know that may not be forever. The help topic doesn't explain very well what command I should be using instead of it.
Any help?
Thanks,
Solved! Go to Solution.
08-23-2017 03:13 AM
Hi TammerDTS
You should use the Data API instead of CHV. In the command CHV you refer to the channel using the channel number. The channel number could change when you move channels in the Data Portal or when you insert channels. So in the Data API you should use channel names instead. To get a value use the following syntax to access the third value in channel "Channelname" in the group "Example":
Data.Root.ChannelGroups("Example").Channels("Channelname").Values(3)
If "Channelname" is unique you can use the following syntax
Data.GetChannel("Channelname").Values(3)
or add the group name to make it unique
Data.GetChannel("Example/Channelname").Values(3)
Hope this helps!
Winfried
08-23-2017 07:43 AM
Well that works, but it seems very ineffient compared to what I'm doing now:
ChV(PNo(Data.Root.ChannelGroups(1).Channels("Time"), 0), "[1]/Seat VZ")
08-25-2017 01:33 AM
Option Explicit dim chO : set chO = data.Root.ChannelGroups(1).Channels(1) dim sum : sum = 0 dim i : for i = 1 to chO.Size sum = sum + chO(i) Next MsgBox sum
To make it more efficient, you can just drop
.values(i)
and access the channel object directly. This can be used for read and write channel values.
This should be faster than ChV.