Hello
When developing scripts, I frequently add channel groups for analysis results, using
call data.root.channelgroups.add("analysis")
However, when re-running the scripts, successive groups "analysis1", "analysis2" etc. are created. This is a handy feature that I should not want to miss at some times, BUT
at other times I want to skip the creation of new channel groups. As a work-around I litter my code with 'exist'-statements such as
If not call data.root.channelgroups.exists("analysis") then
call data.root.channelgroups.add("analysis")
end if
Set oResGrp = data.root.channelgroups("analysis")
Now, my suggestion is to add a command such as "AddOrReplace" or "Use", which would use the existing group if it exists and creates a new group if not. Pretty much the same behaviour as with the calculator, where
CH("NewChannel")= CH("oldChannel") will create a new channel or overwrite an existing one.
So
call data.root.channelgroups.add("analysis")
would work as we know it and
call data.root.channelgroups.Use("analysis")
would create a new object or use the existing one.
Alternatively one could supply an optional paramter to the .Add-method like
call data.root.channelgroups.add("analysis",0)
as default using the well-known behaviour whereas
call data.root.channelgroups.add("analysis",1)
would change to create or replace.
Obviously the same would come in handy for channels or other objects that use an .add-method.
Thank you
Michael