AddToLog: Boolean;
The AddToLog property determines whether the value of binding field is included into the errors log.
True - to include field value into log; False - not to include. Default value is False.
The log can included the fields, which binding has the type CubeMetaLoaderBindingType.Unit or CubeMetaLoaderBindingType.Attribute (the ICubeMetaLoaderBinding.BindingType property).
Executing the example requires that the repository contains a time series database with the RUBRICATOR identifier. The database contains an import object with the OBJ_IMPORT identifier that imports data from all sources excluding time series databases. Add links to the Metabase and Cubes system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
ImpRequestDefDescr: IMetabaseObjectDescriptor;
ImpRequestDef: IImportRequestDefinition;
ImpProvParams: IImportRequestProviderParams;
ImpBindings: ICubeMetaLoaderBindings;
ImpBinding: ICubeMetaLoaderBinding;
i: Integer;
LastBinding: Integer;
Loader: ICubeMetaLoader;
Log: ICubeMetaLoaderLog;
Entry: ICubeMetaLoaderLogEntry;
Count: Integer;
key: Integer;
Begin
Mb := MetabaseClass.Active;
RubrDescr := Mb.ItemById("FC_FOR_IMPORT");
ImpRequestDefDescr := Mb.ItemByIdNamespace("OBJ_IMPORT", RubrDescr.Key);
ImpRequestDef := ImpRequestDefDescr.Edit As IImportRequestDefinition;
ImpProvParams := ImpRequestDef.ProviderParams;
ImpBindings := ImpProvParams.Bindings;
For i := 0 To ImpBindings.Count - 1 Do
ImpBinding := ImpBindings.Item(i);
If (ImpBinding.BindingType = CubeMetaLoaderBindingType.Attribute) Or (ImpBinding.BindingType = CubeMetaLoaderBindingType.Unit) Then
ImpBinding.AddToLog := True;
LastBinding := i;
End If;
End For;
(ImpRequestDef As IMetabaseObject).Save;
Loader := ImpProvParams As ICubeMetaLoader;
Loader.LoadData;
Log := Loader.Log;
For Each key In Loader.InvalidFactors Do
Debug.WriteLine(Error of downloading time series with key: + key.ToString);
End For;
Count := Log.Count;
Debug.WriteLine(Altogether entries in log: + Count.ToString);
For i := 0 To Count - 1 Do
Entry := Log.Item(i);
Debug.WriteLine(i.ToString + " : "
+ Entry.DateBegin.ToString + ", "
+ Entry.RecordNumber.ToString + ", "
+ Entry.Field + ", "
+ "Extra Field = " + Entry.ExtraField(LastBinding) + ", "
+ Entry.ErrorMessage);
If i >= 10 - 1 Then
Break;
End If;
End For;
End Sub UserProc;
After executing the example all the fields for binding of attribute and measurement unit type are included into error log. Then data is imported. The first ten rows of the data import log, that contains field value of the last binding, is displayed in the console window.
See also: