DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

inconsistent handling channelgroup names?

Solved!
Go to solution

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

0 Kudos
Message 1 of 2
(3,523 Views)
Solution
Accepted by topic author mliese

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

0 Kudos
Message 2 of 2
(3,504 Views)