05-11-2015 10:55 AM
Firstly - I am new to both DIAdem and VB so please forgive my ignorance!
I have a large data set containg many groups with (almost) identical channel names in each group. For reasons not worth going into some of the channel names have quoation marks around them, while others do not.
I am trying to remove the quoation marks to make all channel names consistent throughout the groups, for this I was hoping to loop through the groups renaming channels as appropriate
I think this should work:-
For
i = 1 to GROUPCOUNT
Call GROUPDEFAULTSET(i)
CN(""ChannelName"")="ChannelName"
Next
Where ChannelName is the name I am trying to replace, But I get the following error:- Expected ')'
Can anyone point out where I am going wrong?
(Note - I also tried using triple quotation marks ("""ChannelName"""), but I get this error instead - CN(""ChannelName""):=ChannelName Close bracket ")" expected for field index)
For bonus points - how to I get the loop to skip over any groups where the channel I am referencing already doesn't have quotation marks in it, rather than giving me an error that the channel can't be found?
Many thanks in advance for any assistance!
Dan
Solved! Go to Solution.
05-12-2015 01:04 AM
Hello Dan,
You are using an old script syntax to manipulate the data. Please find below the current way to replace quotation marks with an underscote:
dim iLoopG, iLoopC, oGroup, oGroupChns, sQM sQM = chr(34) ' the " character set oGroup = Data.Root.ChannelGroups for iLoopG = 1 to oGroup.Count set oGroupChns = oGroup(iLoopG).Channels for iLoopC = 1 to oGroupChns.Count 'msgbox oGroupChns(iLoopC).Name oGroupChns(iLoopC).Name = Replace(oGroupChns(iLoopC).Name, sQM, "_") next next
Greetings
Walter
05-12-2015 03:57 AM
Hi Walter,
That works perfectly, many thanks for your help!
Dan