Showing results 1 to 4 of 4

Thread: ArchiveValues.DeleteArchiveValue

  1. #1
    Join Date
    17.12.2007
    Posts
    35

    Default ArchiveValues.DeleteArchiveValue

    Is possible to have a little example how to use this method?
    thank you very much

  2. #2
    robertf Gast

    Beitrag Re: ArchiveValues.DeleteArchiveValue

    Hi fabios!

    Here is an small example, additional information you can find in the "VBA Help"!
    I hope this is what you were asking for...

    '##############################################################################
    '## - - - - - - - - - - - HOW TO DELETE ARCHIVE VALUES - - - - - - - - - - - ##
    '##############################################################################
    Public Sub ArvMacro()
    Dim zFilterVars As ArchiveFilterVariables
    Dim zFilterVar As ArchiveFilterVariable
    Dim xTimeConvert As clsTimeConvert          '--> see VBA Help
    Dim zFilter As ArchiveFilter
    Dim bResult As Boolean
    Dim dTime As Double
    Dim zArv As Archive
    Dim i As Integer
    Dim n As Integer
    
        Set zArv = thisProject.Archives.Item("XX")
        If zArv Is Nothing Then Exit Sub
        Set xTimeConvert = New clsTimeConvert   '--> see VBA Help
        Set zFilter = zArv.ArchiveFilters.CreateArchiveFilter
        'SET FILTER CONFIGURATION
        With zFilter
            For i = 0 To zArv.ArchiveVariables.Count - 1
                .AddArchiveVariable zArv.ArchiveVariables.Item(i)
            Next i
            'time conversion
            dTime = xTimeConvert.System2zenOn(CDbl(Now - 0.0104167)) 'Now - 15 minutes
            .StartTime = dTime
            dTime = xTimeConvert.System2zenOn(CDbl(Now))
            .EndTime = dTime
            'All I-BIT and HWERT bits
            .StatusBit = &H41000      'Return data if one of those bits are TRUE or both
            .StatusMask = &H41000     'Check only I-BIT + HWERT
        End With
        Set zFilterVars = zFilter.Query
        
        For i = 0 To zFilterVars.Count - 1
            Set zFilterVar = zFilterVars.Item(i)
            Debug.Print "Variable: " & zFilterVar.ArchiveVariable.Name
            For n = zFilterVar.ArchiveValues.Count - 1 To 0 Step -1
                Debug.Print "  DeleteValue: " & zFilterVar.ArchiveValues.Item(n).Value
                bResult = zFilterVar.ArchiveValues.DeleteArchiveValue(n)
            Next n
        Next i
        'Save changes!
        zFilter.ApplyChanges
    End Sub

  3. #3
    Join Date
    17.12.2007
    Posts
    35

    Default Re: ArchiveValues.DeleteArchiveValue

    Thank you very much, i'll test and i'll give you a feed back

  4. #4
    robertf Gast

    Default Re: ArchiveValues.DeleteArchiveValue

    Here is the Project Backup for Version 6.22...
    Attached Files Attached Files

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •