ValueRecordNumber: Integer;
ValueRecordNumber: integer;
The ValueRecordNumber returns number of error record on the observation level.
The property returns -1 if error record refers to the level of facts.
Executing the example requires a time series database with the OBJ_RUBRICATOR and OBJ_RUBRICATOR_SOUR identifiers. These databases must contain the COUNTRY factors attribute and the COMMENT observation attribute. Add links to the Metabase, Cubes and Dimensions system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Copier: ICubeMetaCopier;
Bindings: ICubeMetaCopierBindings;
Binding: ICubeMetaCopierBinding;
Log: ICubeMetaLoaderLog;
LogEnt: ICubeMetaLoaderLogEntry;
i: Integer;
Begin
MB := MetabaseClass.Active;
Copier := New CubeMetaCopierClass.Create;
// Copying parameters
Copier.CalendarLevelSet := DimCalendarLevelSet.Year;
Copier.DestinationRubricator := MB.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
Copier.SourceRubricator := MB.ItemById("OBJ_RUBRICATOR_SOUR").Bind As IRubricator;
Copier.ImportObjectKey := MB.ItemById("OBJ_RUBRICATOR").Key;
Copier.NewRevisionName := Copy factors;
Bindings := Copier.Bindings;
// Binding of the COUNTRY attribute
Binding := Bindings.Add;
Binding.BindingType := CubeMetaCopierBindingType.Attribute;
Binding.DestinationAttribute := "COUNTRY";
Binding.SourceAttribute := "COUNTRY";
// Binding of the COMMENT attribute
Binding := Bindings.Add;
Binding.BindingType := CubeMetaCopierBindingType.ValueAttribute;
Binding.DestinationAttribute := "COMMENT";
Binding.SourceAttribute := "COMMENT";
// Copy factors and display report
Copier.Copy;
Log := Copier.Log;
For i := 0 To Log.Count - 1 Do
LogEnt := Log.Item(i);
Debug.WriteLine(Record number + LogEnt.RecordNumber.ToString);
Debug.WriteLine(Date of record creation: + LogEnt.DateBegin.ToString);
Debug.WriteLine(Field: + LogEnt.Field);
If LogEnt.IsWarning Then
Debug.WriteLine(Warning: + LogEnt.ErrorMessage);
End If;
If LogEnt.IsError Then
Debug.WriteLine(Error: + LogEnt.ErrorMessage);
Debug.WriteLine(Error code: + LogEnt.ErrorCode.ToString);
Debug.WriteLine(Number of the erratic record of the survey level: + LogEnt.ValueRecordNumber.ToString);
End If;
Debug.WriteLine("----");
End For;
End Sub UserProc;
After executing the example factors of the OBJ_RUBRICATOR_SOUR database are copied to the OBJ_RUBRICATOR database. The report about the copy results is displayed in the console window.
Executing the example requires a time series database with the OBJ_RUBRICATOR and OBJ_RUBRICATOR_SOUR identifiers. These databases must contain the COUNTRY factors attribute and the COMMENT observation attribute.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Copier: ICubeMetaCopier;
Bindings: ICubeMetaCopierBindings;
Binding: ICubeMetaCopierBinding;
Log: ICubeMetaLoaderLog;
LogEnt: ICubeMetaLoaderLogEntry;
i: Integer;
Begin
MB := Params.Metabase;
Copier := New CubeMetaCopierClass.Create();
// Copying parameters
Copier.CalendarLevelSet := DimCalendarLevelSet.dclsYear;
Copier.DestinationRubricator := MB.ItemById["OBJ_RUBRICATOR"].Bind() As IRubricator;
Copier.SourceRubricator := MB.ItemById["OBJ_RUBRICATOR_SOUR"].Bind() As IRubricator;
Copier.ImportObjectKey := MB.ItemById["OBJ_RUBRICATOR"].Key;
Copier.NewRevisionName := Copy factors;
Bindings := Copier.Bindings;
// Binding of the COUNTRY attribute
Binding := Bindings.Add();
Binding.BindingType := CubeMetaCopierBindingType.cmcbtAttribute;
Binding.DestinationAttribute := "COUNTRY";
Binding.SourceAttribute := "COUNTRY";
// Binding of the COMMENT attribute
Binding := Bindings.Add();
Binding.BindingType := CubeMetaCopierBindingType.cmcbtValueAttribute;
Binding.DestinationAttribute := "COMMENT";
Binding.SourceAttribute := "COMMENT";
// Copy factors and display report
Copier.Copy();
Log := Copier.Log;
For i := 0 To Log.Count - 1 Do
LogEnt := Log.Item[i];
System.Diagnostics.Debug.WriteLine(Record number: + LogEnt.RecordNumber.ToString());
System.Diagnostics.Debug.WriteLine(Date of record creation: + LogEnt.DateBegin.ToString());
System.Diagnostics.Debug.WriteLine(Field: + LogEnt.Field);
If LogEnt.IsWarning Then
System.Diagnostics.Debug.WriteLine(Warning: + LogEnt.ErrorMessage);
End If;
If LogEnt.IsError Then
System.Diagnostics.Debug.WriteLine(Error: + LogEnt.ErrorMessage);
System.Diagnostics.Debug.WriteLine(Error code: + LogEnt.ErrorCode.ToString());
System.Diagnostics.Debug.WriteLine(Number of error record of observation level: + LogEnt.ValueRecordNumber.ToString());
End If;
System.Diagnostics.Debug.WriteLine("----");
End For;
End Sub;
After executing the example factors of the OBJ_RUBRICATOR_SOUR database are copied to the OBJ_RUBRICATOR database. The console window displays the report about the copy results.
See also: