Filter: String;
The Filter property determines a filter used for imported data. In this property, it is necessary to specify a condition using identifiers of fields of a table from that data is loaded.
Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier. The database defined for the MDM repository, contains the TabImport table that includes fields with the names as basic dictionary attributes.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
Import: IRdsImportSchemas;
SchemaImport: IRdsImportSchema;
Attrs: IRdsAttributes;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;
Dict := MObj As IRdsDictionary;
Attrs := Dict.Attributes;
Import := Dict.ImportSchemas;
SchemaImport := Import.Add;
SchemaImport.Id := "Import1";
SchemaImport.Name := Import scheme #1;
SchemaImport.Mappings(Attrs.Key).FieldName := "Key";
SchemaImport.Mappings(Attrs.Name).FieldName := "Name";
SchemaImport.Mappings(Attrs.Order).FieldName := "Ord";
SchemaImport.Mappings(Attrs.ParentKey).FieldName := "Parent_key";
SchemaImport.TableName := "TabImport";
SchemaImport.Filter := "Key<100";
MObj.Save;
End Sub Main;
After executing the example a new import scheme is created in the MDM dictionary. Attribute values of a dictionary are imported from same-name fields of the TabImport table. Data is filtered by the value of the Key field on import.
See also: