01-13-2010 02:50 PM
Hello,
while writing script code I observed the following a little bit surprising behaviour in Diadem 11 dealing with ChannelGroups naming conventions. If you executing the following code with each of the three different ChannelGroup names you'll get two times the failed message.
Dim sName
sName = "OK!"
'sName = "Test "
'sName = "x/y"
if not(data.Root.ChannelGroups.Exists(sName)) then
data.Root.ChannelGroups.Add(sName)
end if
if not(data.Root.ChannelGroups.Exists(sName)) then
logfilewrite("Operation failed!")
end if
Ok, the last two ChannelGroup names are not really valid. But why treats Diadem this names different depending on which method of the data.root object is called with the name as parameter? Not really serious but I lost 30 minutes to find out that a ChanneGroup name stored to a variable contains non valid characters. And therefore several operations expecting that the ChannelGroup already exists failed. Bug or feature?
Best Regards
Martin Liese
Solved! Go to Solution.
01-14-2010 10:09 AM
Hi Martin,
Well, it's intentional, but I would hardly call it a feature. DIAdem purposely avoids using the "/" character in any Group or Channel name because of its "Group/Channel" referencing syntax. I actually didn't realize that DIAdem repressed leading or trailing space characters in a Group or Channel name, but your code proves that this is also the case. My personal recommendation is that you hang onto the Group variable instead of the Group name, but even if that's not ideal for you, you can still request the actual name used for the new Group and update your sName variable, like this:
Dim sName, Group
sName = "Test "
sName = "x/y"
if not(data.Root.ChannelGroups.Exists(sName)) then
Set Group = data.Root.ChannelGroups.Add(sName)sName = Group.Name
end if
Brad Turpin
DIAdem Product Support Engineer
National Instruments