Archives (RT) - Read batch information

Archives (RT) - Read batch information

With zenOn 6.22 SP0 a new method has been implemented for read out batch infomration which are stored in the batch index file (.ari).
The method Archive.BatchIndex returns for each batch following information in a String-Array:
ARX-FileName;Batchname;Starttime in seconds;Endtime in seconds
Below you can find an example how to use this method
VBA Code:

Option Explicit
Sub GetBatches_Click()
Dim obArchives As Archives
Dim obArchive As Archive
Dim iArchives As Integer
Dim strArray
Dim iArray As Integer
Dim strArrayBatch
Dim iArrayBatch As Integer
Set obArchives = thisProject.Archives

If obArchives.count = 0 Then
MsgBox "No archives configured!"
Exit Sub
End If

Debug.Print ("Count Archives: " & obArchives.count)

For iArchives = 0 To obArchives.count - 1

'get the single archive
Set obArchive = obArchives.Item(iArchives)
If obArchive Is Nothing Then
MsgBox "Error getting archive " & obArchives.Item(iArchives)
Exit Sub
End If

Debug.Print ("Archive: " & obArchive.Name)

'get the complete batchindex
strArray = obArchive.BatchIndex
Debug.Print ("Count Batches: " & UBound(strArray))

'split up the string array (list of batches)
For iArray = 0 To UBound(strArray)
'get the single batches and split it up
strArrayBatch = Split(strArray(iArray), ";")
'write the each single batch string to the listbox (in seperate columns)
For iArrayBatch = 0 To UBound(strArrayBatch)
'structure of array:
'0=ARX-FileName; 1=Batchname; 2=Starttime in seconds; 3=Endtime in seconds
Debug.Print "-> " & strArrayBatch(iArrayBatch)
Next iArrayBatch
Next iArray
Debug.Print ""
Next iArchives
End Sub


In the attachment you can find a VBA Form which reads out the batch information into a Listbox (seperate columns).
Regards,
Herbert

This is a migrated post! Originally posted on 20.04.2009 by user herberto. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com