Translations: ICubeCreatorFieldTranslations;
The Translations property returns the collection of attribute bindings with translations for source fields.
The property is used on binding the attribute of the String or Long Text type in a multilingual MDM dictionary. On working with multilingual dictionaries, the following options can be used:
If it is necessary to load values of the attribute, which are element names:
Current repository language matches with the dictionary creation language. Create a binding and determine attribute identifier in the AttributeId property.
Current repository language does not match with the dictionary creation language. Create a binding, determine attribute identifier in the AttributeId property and in the Translations collection create a binding for this field and the current repository language.
If it is necessary to load attribute values, which are translations. Create a binding, determine attribute identifier in the AttributeId property and in the Translations collection create bindings for required fields of the source and languages, for which translations are stored in those fields.
Executing the example requires that the repository contains a folder with the F_CUBES identifier where cubes are stored. It is also supposed to have the file C:\Data.xls, which contains columns with the following names:
Value. Column with values.
Date. Column with dates.
Country Name. Column with country names in Russian.
Country Name En. Column with country names in English.
Sub UserProc;
Var
MB: IMetabase;
Loader: ICubeLoaderFromSource;
Provider: IDtExcelProvider;
Bindings: ICubeLoaderDimensionBindings;
Binding: ICubeLoaderDimensionBinding;
Fields: ICubeCreatorFields;
Field: ICubeCreatorField;
FactBindings: ICubeLoaderFactBindings;
FactBinding: ICubeLoaderFactBinding;
Begin
MB := MetabaseClass.Active;
//Data source for cube
Provider := New DtExcelProvider.Create;
Provider.DriverVersion := "Excel 8.0";
Provider.File := "D:\Work\Data.xls";
Provider.HasHeader := True;
Provider.Query := "Select * From [Sheet1$]";
//Cube data loader
Loader := New CubeLoaderFromSource.Create;
Loader.Parent := MB.ItemById("CUBE_FOLDER").Bind;
//Set up bindings of dimensions and facts
Bindings := Loader.DimensionBindings;
Binding := Bindings.Add("Country Name");
Binding.AttributeId := "NAME";
Binding.NewDictionaryName := "Country";
Fields := Binding.Fields;
//Translation attribute binding
Field := Fields.Item(0);
Field.Translations.Add(LocaleCodeID.English_UnitedStates, "Country Name En");
//Calendar
Binding := Bindings.AddCalendar("Date", DimCalendarLevel.Month);
//Facts binding
FactBindings := Loader.FactBindings;
FactBinding := FactBindings.Add("Value");
//Cube creation and data loading
Loader.Load(Provider, Null);
End Sub UserProc;
The import object from Excel and the cube data loader are initialized when executing the example. The dimensions bindings and facts of created cube are set up according to the information about source fields. A multilingual dictionary will be created for countries. On executing the Load method a new standard cube, required dictionaries for dimensions and a table to store data will be created. The data will be imported to the created table.
See also: