DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChV Command in DIAdem 2017

Solved!
Go to solution

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,

 

0 Kudos
Message 1 of 4
(2,797 Views)
Solution
Accepted by topic author TamerZero

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

0 Kudos
Message 2 of 4
(2,756 Views)

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")
0 Kudos
Message 3 of 4
(2,749 Views)
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.

0 Kudos
Message 4 of 4
(2,725 Views)