CheckFieldName: Boolean;
The CheckFieldName property determines whether fields' names are transformed in such a way that number values can be imported.
If the property is set to True, special transformations are made on import to disable changing of fields' numeric names by the provider. If the value is set to False for the fields with numeric names, new names are generated that is F1, F2 and so on.
Executing the example requires the time series database with the OBJ_RUBRICATOR identifier and the time series export file C:\Country By Rows.XLS.
Sub Main;
Var
Excel: IDtExcelProvider;
Provider: IDatasetDataProvider;
Mb: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
CrInfo: IMetabaseObjectCreateInfo;
Obj: IMetabaseObject;
ObjDesc: IMetabaseObjectDescriptor;
ImportRequestDef: IImportRequestDefinition;
ImportRequestProviderParams: IImportRequestProviderParams;
Binding: ICubeMetaLoaderBinding;
Begin
// Data source for import from XLS format
Excel := New DtExcelProvider.Create;
Excel.ImexMode := DtExcelImexMode.Import;
Excel.File := "C:\Country By Rows.XLS";
Excel.Query := "SELECT * FROM [By Rows$]";
Excel.HasHeader := True;
Excel.CheckFieldName := True;
Excel.Open;
Mb := MetabaseClass.Active;
RubDesc := Mb.ItemById("OBJ_RUBRICATOR");
Provider := (Excel As IDatasetDataProvider);
// Import object
CrInfo := Mb.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_IMPORTREQUEST;
CrInfo.Id := "OBJ_IMPORTREQUEST_P";
CrInfo.Name := "Import object";
CrInfo.Permanent := True;
CrInfo.Parent := RubDesc.Bind;
ObjDesc := Mb.CreateObject(CrInfo);
Obj := ObjDesc.Edit;
// Source setting
ImportRequestDef := Obj As IImportRequestDefinition;
ImportRequestDef.SourceType := ImportRequestSourceType.Provider;
ImportRequestDef.DestinationRubricator := RubDesc.Bind As IRubricator;
// Import parameters
ImportRequestProviderParams := ImportRequestDef.ProviderParams;
ImportRequestProviderParams.Provider := Provider;
ImportRequestProviderParams.NewRevisionName := "Indicators import";
ImportRequestProviderParams.ImportObjectKey := Obj.Key;
ImportRequestProviderParams.LoadType := CubeMetaLoaderLoadType.CreateAndUpdate;
Binding := ImportRequestProviderParams.Bindings.Add;
Binding.BindingType := CubeMetaLoaderBindingType.Calendar;
Binding.CalendarOptions.Levels := DimCalendarLevelSet.Year;
Binding.ByColumns := False;
Binding.CalendarDateFormat := "$Year$";
Obj.Save;
End Sub Main;
After executing the example factors import object from the file C:\Country By Rows.XLS is created. In the object calendar parameters are set. If the string with fields' titles contains numeric names, they are not replaced on import.
See also: