06-03-2013 10:10 AM
It is seems that when I am running this type of script on a lengthly data column it takes a long time to run. Is there anyway to speed this up?
if Data.Root.ChannelGroups(1).Channels.Exists("Amber Warning Lamp Status") then
lst = globusedchn + 1
j = chnlength(1)
call chnalloc("AMBER_LAMP",j)
for i = 1 to j
State = cht(i,"[1]/Amber Warning Lamp Status")
IF dict3.Exists(State) THEN
chd(i,lst) = dict3.Item(State)
end if 'dict3
next
Call ChnPropSet(("[1]/AMBER_LAMP"), "unit_string", "Off/On") 'Set Unit
End if 'Parameter Name
06-04-2013 01:24 AM
Hi Jcheese,
Please gibe this a try:
dim oCurrGroupChns, oAmberWLSChn, oAmberLampChn set oCurrGroupChns = Data.Root.ChannelGroups(1).Channels if oCurrGroupChns.Exists("Amber Warning Lamp Status") then set oAmberWLSChn = oCurrGroupChns("Amber Warning Lamp Status") set oAmberLampChn = oCurrGroupChns.Add("AMBER_LAMP") for i = 1 to oCurrGroupChns(1).Size State = oAmberWLSChn(i) IF dict3.Exists(State) THEN oAmberLampChn(i) = dict3.Item(State) end if 'dict3 next Call oAmberLampChn.Properties("unit_string").Value = "Off/On" End if 'Parameter Name
Greetings
Walter
06-04-2013 06:25 AM
Sorry, This did not work.
Gave two error messages
Error in <NoName(1).VBS> (Line: 16, Column: 3):
Argument not optional: 'Add'
Error in <NoName(1).VBS> (Line: 25, Column: 54):
Expected end of statement
06-04-2013 06:51 AM
I didn't test it because I have not test data for the problem
Please try this:
dim oCurrGroupChns, oAmberWLSChn, oAmberLampChn, i, state, dict3 set oCurrGroupChns = Data.Root.ChannelGroups(1).Channels set dict3 = CreateObject("Scripting.Dictionary") if oCurrGroupChns.Exists("Amber Warning Lamp Status") then set oAmberWLSChn = oCurrGroupChns("Amber Warning Lamp Status") set oAmberLampChn = oCurrGroupChns.Add("AMBER_LAMP",DataTypeChnString) for i = 1 to oCurrGroupChns(1).Size State = oAmberWLSChn(i) IF dict3.Exists(State) THEN oAmberLampChn(i) = dict3.Item(State) end if 'dict3 next oAmberLampChn.Properties("unit_string").Value = "Off/On" End if 'Parameter Name
Greetings
Walter