ICubeCreatorField.Translations

Fore Syntax

Translations: ICubeCreatorFieldTranslations;

Fore.NET Syntax

Translations: Prognoz.Platform.Interop.Cubes.ICubeCreatorFieldTranslations;

Description

The Translations property returns the collection of attribute bindings with translations for source fields.

Comments

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:

Fore Example

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:

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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Metabase;

Public Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Loader: ICubeLoaderFromSource = New CubeLoaderFromSourceClass();
    Provider: IDtExcelProvider = New DtExcelProviderClass();
    Bindings: ICubeLoaderDimensionBindings;
    Binding: ICubeLoaderDimensionBinding;
    Fields: ICubeCreatorFields;
    Field: ICubeCreatorField;
    FactBindings: ICubeLoaderFactBindings;
    FactBinding: ICubeLoaderFactBinding;
Begin
    MB := Params.Metabase;
    //Data source for cube
    Provider.DriverVersion := "Excel 8.0";
    Provider.File := "D:\Work\Data.xls";
    Provider.HasHeader := True;
    Provider.Query := "Select * From [Sheet1$]";
    //Cube data loader 
    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.lcidEnglish_UnitedStates, "Country Name En");
    //Calendar
    Binding := Bindings.AddCalendar("Date", DimCalendarLevel.dclMonth);
    //Facts binding
    FactBindings := Loader.FactBindings;
    FactBinding := FactBindings.Add("Value");
    //Cube creation and data loading
    Loader.Load(Provider, Null);
End Sub;

See also:

ICubeCreatorField