IRubricatorInstance.ClearEx

Fore Syntax

ClearEx(
       Mode: CubeLoadClearMode;
       FactorKeys: Array;
       FactsAttrs: String;
       ValuesAttrs: String;
       [ExtraOptions: CubeClearOptions = 0]);

Fore.NET Syntax

ClearEx(
       Mode: Prognoz.Platform.Interop.Cubes.CubeLoadClearMode;
       FactorKeys: System.Array;
       FactsAttrs: string;
       ValuesAttrs: string;
       ExtraOptions: Prognoz.Platform.Interop.Cubes.CubeClearOptions);

Parameters

Mode. The mode of clearing time series database.

FactorKeys. The array of time series keys that must be cleared.

FactsAttrs. Series attributes to be cleared.

ValuesAttrs. Observation attributes to be cleared.

ExtraOptions. Additional parameters of time series database clearing.

Description

The ClearEx method clears the time series database according to the specified advanced parameters.

Comments

On working with the method consider aspects of specifying the following parameters:

When working the method checks the capability of clearing the attribute: if some attribute cannot have empty values, its values will not be reset.

Fore Example

Executing the example requires that the repository contains a time series database with the TSDB identifier. This database must contain the following series attributes: "COUNTRY" that is a link on the dictionary, and the "NOTES" string attribute.

Add links to the Cubes, Dimensions, Metabase, Orm, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    RubInstance: IRubricatorInstance;
    Lookup: IRubricatorFactsLookup;
    MetaDLookup: IMetaDictionaryLookup;
    Cond: IOrmCondition;
    FactorKeys: Array Of Integer;
Begin
    MB := MetabaseClass.Active;
    // Get instance of time series database
    RubInstance := MB.ItemById("TSDB").Open(NullAs IRubricatorInstance;
    // Create an object to search in time series database
    Lookup := RubInstance.CreateFactsLookup;
    MetaDLookup := Lookup.Lookup;
    Cond := MetaDLookup.Where.Add;
    // Specify that search is executed to those time series,
    // that have the COUNTRY attribute with the 512 value
    Cond.AttributeName := "COUNTRY";
    Cond.Value := 512;
    // Search and get keys of time series that are found
    MetaDLookup.Open(DictionaryCursorOptions.None);
    FactorKeys := MetaDLookup.LookupKeys("KEY");
    MetaDLookup.Close;
    // Clear time series database
    RubInstance.ClearEx(CubeLoadClearMode.MetadataOnly, FactorKeys, "NOTES""*", CubeClearOptions.NoCreateRevision);
End Sub UserProc;

After executing the example, the time series database has been cleared without creating a new revision: metadata of the NOTES series attributes and all observation attributes are cleared for all time series that have the value of the COUNTRY attribute equal to 512.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Orm;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    RubInstance: IRubricatorInstance;
    Lookup: IRubricatorFactsLookup;
    MetaDLookup: IMetaDictionaryLookup;
    Cond: IOrmCondition;
    FactorKeys: System.Array;
Begin
    MB := Params.Metabase;
    // Get instance of time series database
    RubInstance := MB.ItemById["TSDB"].Open(NullAs IRubricatorInstance;
    // Create an object to search in time series database
    Lookup := RubInstance.CreateFactsLookup();
    MetaDLookup := Lookup.Lookup;
    Cond := MetaDLookup.Where.Add();
    // Specify that search is executed to those time series,
    // that have the COUNTRY attribute with the 512 value
    Cond.AttributeName := "COUNTRY";
    Cond.Value := 512;
    // Search and get keys of time series that are found
    MetaDLookup.Open(DictionaryCursorOptions.dcuoNone);
    FactorKeys := MetaDLookup.LookupKeys("KEY");
    MetaDLookup.Close();
    // Clear time series database
    RubInstance.ClearEx(CubeLoadClearMode.clcmMetadataOnly, FactorKeys, "NOTES""*", CubeClearOptions.ccoNoCreateRevision);
End Sub;

See also:

IRubricatorInstance