Possible to Channel.Add with channel name contained in a string?


Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.