IRdsDictionaryFilterCondition.Value

Fore Syntax

Value: Variant;

Fore.NET Syntax

Value: System.Object;

Description

The Value property determines value of the attribute, by which elements are filtered.

Comments

If the Value property is not determined, correct work of filter is impossible.

If Value contains the values array of the Variant type and the IRdsDictionaryFilterCondition.Operation property has the value:

Fore Example

Executing the example requires that the repository contains an MDM repository with the MDM_REPO identifier. The repository must contain a table MDM dictionary with the EXP_DICT identifier.

A text file C:\Data_out.txt must be created in the file system.

Add links to the Metabase, Rds, and Dt system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    rdsKey: Integer;
    dictObj: IMetabaseObject;
    Dict: IRdsDictionary;
    sExport: IMetaRdsExportSchema;
    i: Integer;
    dictAts: IRdsAttributes;
    Attr: IRdsAttribute;
    attrMap: IRdsExportSchemaAttribute;
    dictFilter: IRdsDictionaryFilterConditions;
    Cond: IRdsDictionaryFilterCondition;
    textCons: IDtTextConsumer;
    dictInst: IRdsDictionaryInstance;
Begin
    mb := MetabaseClass.Active;
    // Get key of the MDM repository
    rdsKey := mb.GetObjectKeyById("MDM_REPO");
    // Get table MDM dictionary
    dictObj := mb.ItemByIdNamespace("EXP_DICT", rdsKey).Edit;
    Dict := dictObj As IRdsDictionary;
    // Create a new export scheme
    sExport := Dict.ExportSchemas.Add As IMetaRdsExportSchema;
    // Bind dictionary attributes to the consumer fields
    dictAts := Dict.Attributes;
    For i := 0 To dictAts.Count - 1 Do
        Attr := dictAts.Item(i);
        attrMap := sExport.AddMapping;
        attrMap.Attribute := Attr;
        attrMap.FieldName := Attr.Id;
    End For;
    // Determine that the consumer must be cleared before export
    sExport.ClearBeforeExport := True;
    // Add filtering
    dictFilter := sExport.Filter;
    Attr := dictAts.FindById("KEY");
    Cond := dictFilter.Add(Attr);
    Cond.Value := 0;
    Cond.Operation := RdsConditionOperation.GreaterOrEqual;
    Cond := dictFilter.Add(Attr);
    Cond.Value := 15;
    Cond.Operation := RdsConditionOperation.LesserOrEqual;
    // Set up data consumer: text file
    textCons := New DtTextConsumer.Create;
    textCons.File := "c:\Data_out.txt";
    textCons.WriteHeader := True;
    textCons.RowDelimiter := #13 + #10;
    textCons.DelimitedColumnDelimiter := #9;
    textCons.DelimitedTextQualifier := "'";
    sExport.Consumer := textCons;
    // Save the dictionary
    dictObj.Save;
    // Export
    dictInst := dictObj.Open(NullAs IRdsDictionaryInstance;
    dictInst.ExportData(sExport);
End Sub UserProc;

Example execution result: elements with the key values in the range [0; 15] are exported from the table MDM dictionary to the file C:\Data_out.txt.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    rdsKey: uinteger;
    dictObj: IMetabaseObject;
    Dict: IRdsDictionary;
    sExport: IMetaRdsExportSchema;
    i: Integer;
    dictAts: IRdsAttributes;
    Attr: IRdsAttribute;
    attrMap: IRdsExportSchemaAttribute;
    dictFilter: IRdsDictionaryFilterConditions;
    Cond: IRdsDictionaryFilterCondition;
    textCons: IDtTextConsumer;
    dictInst: IRdsDictionaryInstance;
Begin
    mb := Params.Metabase;
    // Get key of the MDM repository
    rdsKey := mb.GetObjectKeyById("MDM_REPO");
    // Get table MDM dictionary
    dictObj := mb.ItemByIdNamespace["EXP_DICT", rdsKey].Edit();
    Dict := dictObj As IRdsDictionary;
    // Create a new export scheme
    sExport := Dict.ExportSchemas.Add() As IMetaRdsExportSchema;
    // Bind dictionary attributes to the consumer fields
    dictAts := Dict.Attributes;
    For i := 0 To dictAts.Count - 1 Do
        Attr := dictAts.Item[i];
        attrMap := sExport.AddMapping();
        attrMap.Attribute := Attr;
        attrMap.FieldName := Attr.Id;
    End For;
    // Indicate, that the consumer must be cleared before export
    sExport.ClearBeforeExport := True;
    // Add filter
    dictFilter := sExport.Filter;
    Attr := dictAts.FindById("KEY");
    Cond := dictFilter.Add(Attr);
    Cond.Value := 0;
    Cond.Operation := RdsConditionOperation.rcoGreaterOrEqual;
    Cond := dictFilter.Add(Attr);
    Cond.Value := 15;
    Cond.Operation := RdsConditionOperation.rcoLesserOrEqual;
    // Set up data consumer: text file
    textCons := New DtTextConsumer.Create();
    textCons.File := "c:\Data_out.txt";
    textCons.WriteHeader := True;
    textCons.DelimitedTextQualifier := "'";
    sExport.Consumer := textCons;
    // Save the dictionary
    dictObj.Save();
    // Export execution
    dictInst := dictObj.Open(NullAs IRdsDictionaryInstance;
    dictInst.ExportData(sExport);
End Sub;

See also:

IRdsDictionaryFilterCondition