kanber Posted December 12, 2011 Share Posted December 12, 2011 Hi, I have problem with add channels from seq. I write code like below; channel.ClearAll() channel.Add("Test215",0,"A/D",0,21) channel.Add("Test216",0,"D/A",0,22) channel.Add("Test217",0,"String",0,23) Channel.Restart() But channel type always "A to D". it is not changing. Also history is 3600. I want to change that also 1 with add function. My Sql table like below; Valf1 99.5 Valf2 89.5 Valf3 79.5 Valf4 69.5 Valf5 59.5 I want to read that table from SQL and create channel name with values from sql server. Link to comment Share on other sites More sharing options...
AzeoTech Posted December 12, 2011 Share Posted December 12, 2011 The I/O type must match EXACTLY what it says in the channel table. So, you have to put D to A, not D/A, etc. If it doesn't match, it uses the first I/O type. As for changing history, once you create the channel, you can edit its parameters programatically. The Add() function is designed to require only the minimum to create a channel to keep the # of parameters reasonable. Link to comment Share on other sites More sharing options...
kanber Posted December 13, 2011 Author Share Posted December 13, 2011 You can see my code. and also channel list. 1- I want to add all channel IO type string. 2- I want to be history lenght 1 for all channel dbase = db.Open("ScadaTest") try qr = db.QueryToClass(dbase,"select * from CSVTest13") helper = qr.Name helper2 = qr.ChValue catch() System.ErrorMessage(strLastError) endcatch db.close(dbase) global ddd=111 channel.ClearAll() for(private.count=0, count<NumRows(helper), count++) channel.Add(helper[count],0,"String",count,count) Execute(helper[count]+".AddValue(helper2[count])") ddd=count endfor Channel.Restart() Link to comment Share on other sites More sharing options...
AzeoTech Posted December 15, 2011 Share Posted December 15, 2011 You are missing the Device type parameter. It must be "Test": channel.Add(helper[count], "Test", 0, "String", count) Without it, you are sending parameters in the wrong place, thus the weird result. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.