1 Reply Latest reply on Dec 9, 2014 5:14 AM by xwang

    Trying to add a value to a PIValues collection.

    dmauldin@dbmsoft.com
      I am trying to filter the bad values from a PIValues collection.  I am getting an error message saying "The PIValues collection is read only."   Error number is -2147220033. Could you help with the Read Only  part of the error.   I saw a similar call using C# in another example. THanks don Essential Elements of code ->     Set pt = ptlistDayUseGre.Item(I)     Set pivaluesDayGREall = pt.Data.RecordedValues(timeDayStart.LocalDate, timeDayEnd.LocalDate, btOutside)     Set pivaluesDaySCN = ptlistDayUseSCN.Item(I).Data.RecordedValues(timeDayStart.LocalDate, timeDayEnd.LocalDate, btOutside)        Set pivaluesIntervalGREall = pt.Data.RecordedValues(timeIntervalStart.LocalDate, timeintervalEnd.LocalDate, btOutside)     Set pivaluesIntervalSCN = ptlistIntervalUseSCN.Item(I).Data.RecordedValues(timeIntervalStart.LocalDate, timeintervalEnd.LocalDate, btOutside)     '  remove the bad values from GRE         Set pivaluesDayGRE = Nothing     Set pivaluesIntervalGRE = Nothing     Set pivaluesDayGRE = New PIValues     Set pivaluesIntervalGRE = New PIValues         For Each pivalueChk In pivaluesDayGREall         If pivalueChk.IsGood Then             pivaluesDayGRE.Insert pivalueChk                                  'THIS LINE GIVES THE "READ ONLY" ERROR MESSAGE             don = 1         End If     Next pivalueChk                 For Each pivalueChk In pivaluesIntervalGREall         If pivalueChk.IsGood Then             pivaluesIntervalGRE.Add pivalueChk.TimeStamp, pivalueChk.Value, pivalueChk.ValueAttributes           ' 'THIS CALL ALSO GIVES THE "READ ONLY" ERROR MESSAGE             Else             don = 1         End If     Next pivalueChk