shimh Posted June 11, 2008 Share Posted June 11, 2008 I would like to add a channel by Channel.Add with the channel name provided by a string. It is something like abc="MyChannel" Channel.Add (abc) I tried the above code and it is not working. What is the proper code for such purpose if it is possible? Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 11, 2008 Share Posted June 11, 2008 That should work fine, provided abc is declared as a string variable. Please note, however, as stated in the help under Channel.Add(), the workspace will not be updated when you do the Add(). Likewise, if you are in the channel table view, it won't update until you go to another screen and back. The reason for this is because Add() is designed to be used in runtime which doesn't have these. Link to comment Share on other sites More sharing options...
shimh Posted June 13, 2008 Author Share Posted June 13, 2008 Is it possible to remove channel by command? Say each sensor need 20 Channels to monitor, and we have 20 sensors. There will be add/remove activities on those sensors (according to the post on UI, it is actually hidden/show+move happening). If we cannot remove channels, eventually there will be 400 active channels while probably maybe only 100 is currently useful. Thanks. Link to comment Share on other sites More sharing options...
shimh Posted June 13, 2008 Author Share Posted June 13, 2008 Sorry, just saw delete is a member function of Channel. I didn't see "delete" in the manual though. If it is for what I meant in my post just sent, I think my problem is solved. Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 13, 2008 Share Posted June 13, 2008 Yup, delete should work as you expect. Just put the channel name in quotes: channel.delete("mychannel"). Also, don't forget to do Channel.Restart() after adding or removing channels to reset the timing loops. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.