IAuditLog.ArchiveToDate

Syntax

ArchiveToDate(Stamp: DateTime;

FileName: String;

[Callback: IAuditLogArchiveCallback = Null];

[Format: AuditLogArchiveFormat = 0];

[ClearLog: Boolean = False]);

Archive(System.DateTime,

FileName: string;

Callback: Prognoz.Platform.Interop.Metabase.IAuditLogArchiveCallback,

Format: Prognoz.Platform.Interop.Metabase.AuditLogArchiveFormat,

ClearLog: boolean);

Parameters

Stamp. Date limiting the last records that will be archived.

FileName. File name.

Callback. Object that is used to monitor archiving of access protocol.

Format. File format where the data is stored.

ClearLog. Parameter that determines records removing from the access protocol after archiving. The False value was set by default, the records are not removed. If the True value is set, all saved records are removed from the access protocol after archiving.

Description

The ArchiveToDate method archives a part of the access protocol in the file.

Comments

The records starting with the first one and finishing with the last one, the date of which is earlier the date that is passed by the Stamp parameter, are archived in the file.

Example

Executing the example requires the Gurnal_Part.csv file.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    AL: IAuditLog;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    
// Open access protocol
    Al := MS.OpenAuditLog;
    
// Save access protocol to file
    AL.ArchiveToDate(DateTime.ComposeDay(20190110), "C:\Gurnal_Part.csv"Null0True);
    
// Check in license
    Lic := Null;
End Sub UserProc;

Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    AL: IAuditLog;
    Lic: Object;
    DateTime: System.DateTime;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
     MS := MB.Security;
    DateTime := 
New DateTime(20190110);
    
// Open access protocol
    Al := MS.OpenAuditLog();
    
// Save access protocol to file
    AL.ArchiveToDate(DateTime, "C:\Gurnal_Part.csv"Null, AuditLogArchiveFormat.alafBinary, True);
    
// Check in license
    Lic := Null;
End Sub;

After executing this example the records of access protocol starting with the first one and finishing with the last one that is earlier than 10.01.2019 are saved on the Gurnal_Part.csv file. These records are removed from the access protocol of the current repository after saving.

See also:

IAuditLog