IValidationFilters.Add

Fore Syntax

Add(Filter: Object);

Fore.NET Syntax

Add(Filter: object);

Parameters

Filter. Validation filter.

Description

The Add method adds filter to the collection.

Fore Example

Executing the example requires that the repository contains a time series database with the TSDB identifier that contains a validation rule with the VALID_MISSING_DATA andVALID_GROWTH_RATE identifiers.

Add links to the Cubes, Metabase, Ms system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    RubDescr: IMetabaseObjectDescriptor;
    CreateInfo: IMetabaseObjectCreateInfo;
    ValidGroupObj: IMetabaseObject;
    ValidGroup: IValidationGroup;
    ValidFilters: IValidationFilters;
    FilterDescr: IMetabaseObjectDescriptor;
    ValidExecSett: IValidationExecuteSettings;
    ValidExecRun: IValidationExecRun;
Begin
    
// Get repository
    Mb := MetabaseClass.Active;
    
// Get time series database
    RubDescr := Mb.ItemById("TSDB");
    
// Create a validation group
    CreateInfo := Mb.CreateCreateInfo;
    CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_VALIDATIONGROUP;
    CreateInfo.Parent := RubDescr;
    CreateInfo.Permanent := 
True;
    
// Set up validation group
    ValidGroupObj := Mb.CreateObject(CreateInfo).Edit;
    ValidGroup := ValidGroupObj 
As IValidationGroup;
    
// Add validation rules to group
    ValidFilters := ValidGroup.ValidationFilters;
    FilterDescr := Mb.ItemByIdNamespace(
"VALID_MISSING_DATA", RubDescr.Key);
    ValidFilters.Add(FilterDescr);
    FilterDescr := Mb.ItemByIdNamespace(
"VALID_GROWTH_RATE", RubDescr.Key);
    ValidFilters.Add(FilterDescr);
    
// Save changes
    ValidGroupObj.Save;
    
// |Execute validation group
    ValidExecSett := New ValidationExecuteSettings.Create;
    ValidExecRun := ValidGroup.Execute(ValidExecSett);
End Sub UserProc;

After executing the example a group of validation filters, composed of two filters, is created. This group is executed, execution results are saved.

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.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    RubDescr: IMetabaseObjectDescriptor;
    CreateInfo: IMetabaseObjectCreateInfo;
    ValidGroupObj: IMetabaseObject;
    ValidGroup: IValidationGroup;
    ValidFilters: IValidationFilters;
    FilterDescr: IMetabaseObjectDescriptor;
    ValidExecSett: ValidationExecuteSettings;
    ValidExecRun: IValidationExecRun;
Begin
    // Get repository
    Mb := Params.Metabase;
    // Get time series database
    RubDescr := Mb.ItemById["TSDB"];
    // Create a validation group
    CreateInfo := Mb.CreateCreateInfo();
    CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_VALIDATIONGROUP As integer;
    CreateInfo.Parent := RubDescr;
    CreateInfo.Permanent := True;
    // Set up validation group
    ValidGroupObj := Mb.CreateObject(CreateInfo).Edit();
    ValidGroup := ValidGroupObj As IValidationGroup;
    // Add validation rules to group
    ValidFilters := ValidGroup.ValidationFilters;
    FilterDescr := Mb.ItemByIdNamespace["VALID_MISSING_DATA", RubDescr.Key];
    ValidFilters.Add(FilterDescr);
    FilterDescr := Mb.ItemByIdNamespace["VALID_GROWTH_RATE", RubDescr.Key];
    ValidFilters.Add(FilterDescr);
    // Save changes
    ValidGroupObj.Save();
    // Execute validation group
    ValidExecSett := New ValidationExecuteSettings.Create();
    ValidExecRun := ValidGroup.Execute(ValidExecSett);
End Sub;

See also:

IValidationFilters