 BESandford
		
			BESandford
		
		
		
		
		
		
		
		
	
			05-05-2015 09:55 AM
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?
Solved! Go to Solution.
 AndreasK
		
			AndreasK
		
		
		
		
		
		
		
		
	
			05-06-2015 03:32 AM
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.
05-06-2015 06:04 AM
Thank you that is exactly what I needed