AttributeKey: Integer;
The AttributeKey property determines a key of factor attribute.
The following methods can be used to bind attributes of time series database to consumer fields:
Using attributes identifiers: the ICubeMetaLoaderBinding.Attribute property.
Using attributes keys: the AttributeKey property.
Using both attributes keys and identifiers.
If only attribute identifiers are used for binding then errors may occur on import if the attribute identifier in time series database has been changed. Binding with attributes keys use is safer.
Executing the example requires a time series database with the OBJ_RUBRICATOR identifier. This time series database must have an object of time series import with the OBJ_IMPORTREQUEST identifier. Also add links to the Cubes, Metabase and Rds system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
ImportRequestDef: IImportRequestDefinition;
ImportRequestProviderParams: IImportRequestProviderParams;
Rubr: IRubricator;
FactsDict: IMetaDictionary;
Attr: IMetaAttribute;
Binds: ICubeMetaLoaderBindings;
Binding: ICubeMetaLoaderBinding;
i: Integer;
Begin
Mb := MetabaseClass.Active;
RubDesc := Mb.ItemById("OBJ_RUBRICATOR");
Obj := Mb.ItemByIdNamespace("OBJ_IMPORTREQUEST", RubDesc.Key).Edit;
// Parameters import
ImportRequestDef := Obj As IImportRequestDefinition;
ImportRequestProviderParams := ImportRequestDef.ProviderParams;
Binds := ImportRequestProviderParams.Bindings;
Rubr := RubDesc.Bind As IRubricator;
FactsDict := Rubr.Facts;
For i := 0 To Binds.Count - 1 Do
Binding := Binds.Item(i);
If Binding.BindingType = CubeMetaLoaderBindingType.Attribute Then
Attr := FactsDict.Attributes.FindById(Binding.Attribute);
Binding.AttributeKey := Attr.Key;
End If;
End For;
Obj.Save;
End Sub UserProc;
After executing the example import object is reconfigured: attributes are bound by keys and identifiers.
See also: