DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to make this type of Script run the data faster?

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

0 Kudos
Message 1 of 4
(5,361 Views)

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

 

0 Kudos
Message 2 of 4
(5,345 Views)

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

0 Kudos
Message 3 of 4
(5,337 Views)

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

 

0 Kudos
Message 4 of 4
(5,327 Views)