DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to add indiviual values to the end of an existing channel

Solved!
Go to solution

I have a program the calulates several values from my data and want to write each one sequentialy into a new channel that I have created.  How do I assign a value to the end of a channel?

0 Kudos
Message 1 of 3
(5,115 Views)
Solution
Accepted by topic author BESandford
Option Explicit

dim chObj : set chObj = data.Root.ChannelGroups.Add("Target").Channels.Add("Target",DataTypeChnFloat64)
' OPTIONAL: channel will automatically grow. To speed this up it is possible to reserve before start
chObj.ReservedSize = 1000

call AppendValue(chObj, 1.0)
call AppendValue(chObj, 2.0)
call AppendValue(chObj, 3.0)
call AppendValue(chObj, 4.0)
call AppendValue(chObj, 5.0)

Sub AppendValue(chObj, newVal)
  chObj.Values(chObj.Size + 1) = newVal
end Sub

Channel grows automatically. Be aware that it might be useful to use ReservedSize property if you can assume how long the channel will be.

Message 2 of 3
(5,099 Views)

Thank you that is exactly what I needed

0 Kudos
Message 3 of 3
(5,095 Views)