CreateRubricator: IRubricator;
CreateRubricator: Prognoz.Platform.Interop.Cubes.IRubricator;
The CreateRubricator method creates a time series database.
The IRubricatorCreator.CreateInfo property determines basic parameters of time series database as a repository object.
Executing the example requires that the repository contains the following:
Data table with the T_TSDB identifier that contains the following fields:
| Identifier | Field type | Comment |
| COUNTRY | Integer | Mandatory and included into the primary index. |
| INDICATOR | Integer | Mandatory and included into the primary index. |
| DL | Integer | Mandatory and included into the primary index. |
| VALUE | Real | Optional. |
| DT | Date | Optional. |
| ACT | Logical | Optional. |
MDM repository with the MDM_REPO identifier that contains the following:
Measures dictionary with the MEASURES identifier.
Units dictionary with the UNITS identifier.
Countries dictionary with the DICT_CTR identifier.
Factors dictionary with the DICT_IND identifier.
Calendar dictionary with the D_CALEND identifier.
Example execution result: a time series database that is based on the T_TSDB data table is created. This database contains custom attributes of the COUNTRY and INDICATOR factors that refer to the DICT_CTR and DICT_IND MDM dictionaries.
Add links to the Mb, Cubes, Rds, Db, Dal, Dimensions system assemblies.
<font color="#008080">Sub</font> UserProc;<br /> <font color="#008080">Var</font><br /> mb: IMetabase;<br /> cr: IRubricatorCreator;<br /> CrInfo: IMetabaseObjectCreateInfo;<br /> mbObj: IMetabaseObjectDescriptor;<br /> RdsKey: Integer;<br /> Bs: IRubricatorCreatorBindings;<br /> bindCountry, bindIndicator: IRubricatorCreatorBinding;<br /> bindDLfacts, bindValues, bindDate, bindC: IRubricatorCreatorBinding;<br /> <font color="#008080">Begin</font><br /> mb := MetabaseClass.Active;<br /> cr := <font color="#008080">New</font> RubricatorCreator.Create;<br /> <font color="#008000">// Create repository<br /> </font> cr.Metabase := mb;<br /> <font color="#008000">// Specify parameters of the created time series DB<br /> </font> CrInfo := cr.CreateInfo;<br /> CrInfo.Id := mb.generateId(<font color="#800000">"RUBRICATOR"</font>);<br /> CrInfo.Name := <font color="#800000">"Time series database"</font>;<br /> CrInfo.Parent := mb.Root;<font color="#008000"><br /> </font> <font color="#008000">// Create RDS repository<br /> </font> mbObj := mb.ItemById(<font color="#800000">"RDS_REPO"</font>);<br /> RdsKey := mbObj.Key;<br /> cr.RdsDatabase := mbObj.Bind <font color="#008080">As</font> IRdsDatabase;<br /> <font color="#008000">// Specify data table<br /> </font> mbObj := mb.ItemById(<font color="#800000">"T_TSDB"</font>);<br /> cr.SourceTable := mbObj.Bind <font color="#008080">As</font> ITable;<br /> <font color="#008000">// Specify attribute bindings<br /> </font> Bs := cr.Bindings;<br /> <font color="#008000">// Country factor attribute binding<br /> </font> bindCountry := Bs.Add;<br /> bindCountry.Dictionary := RubricatorDictionary.Facts;<br /> bindCountry.AttributeId := <font color="#800000">"COUNTRY"</font>;<br /> bindCountry.AttributeName := <font color="#800000">"Country"</font>;<br /> bindCountry.UseField := <font color="#008080">True</font>;<br /> bindCountry.SourceFieldId := <font color="#800000">"COUNTRY"</font>;<br /> bindCountry.DataType := DbDataType.Integer;<br /> bindCountry.Kind := (MetaAttributeKind.Dimension);<br /> bindCountry.ValuesObject := mb.ItemByIdNamespace(<font color="#800000">"DICT_CTR"</font>, RdsKey);<br /> bindCountry.Nullable := <font color="#008080">False</font>;<br /> bindCountry.IsDimension := <font color="#008080">True</font>;<br /> bindCountry.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Idicator factors attribute binding<br /> </font> bindIndicator := Bs.Add;<br /> bindIndicator.Dictionary := RubricatorDictionary.Facts;<br /> bindIndicator.AttributeId := <font color="#800000">"INDICATOR"</font>;<br /> bindIndicator.AttributeName := <font color="#800000">"Factor"</font>;<br /> bindIndicator.UseField := <font color="#008080">True</font>;<br /> bindIndicator.SourceFieldId := <font color="#800000">"INDICATOR"</font>;<br /> bindIndicator.DataType := DbDataType.Integer;<br /> bindIndicator.Kind := (MetaAttributeKind.Dimension);<br /> bindIndicator.Tag := MetaAttributeTag.None;<br /> bindIndicator.ValuesObject := mb.ItemByIdNamespace(<font color="#800000">"DICT_IND"</font>, RdsKey);<br /> bindIndicator.Nullable := <font color="#008080">False</font>;<br /> bindIndicator.IsDimension := <font color="#008080">True</font>;<br /> bindIndicator.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Period factors attribute binding<br /> </font> bindDLfacts := Bs.Add;<br /> bindDLfacts.Dictionary := RubricatorDictionary.Facts;<br /> bindDLfacts.AttributeId := <font color="#800000">"DL"</font>;<br /> bindDLfacts.UseField := <font color="#008080">True</font>;<br /> bindDLfacts.SourceFieldId := <font color="#800000">"DL"</font>;<br /> bindDLfacts.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Value observation attribute binding<br /> </font> bindValues := Bs.Add;<br /> bindValues.Dictionary := RubricatorDictionary.Values;<br /> bindValues.AttributeId := <font color="#800000">"VL"</font>;<br /> bindValues.UseField := <font color="#008080">True</font>;<br /> bindValues.SourceFieldId := <font color="#800000">"VALUE"</font>;<br /> <font color="#008000">// Data observation attribute binding<br /> </font> bindDate := Bs.Add;<br /> bindDate.Dictionary := RubricatorDictionary.Values;<br /> bindDate.AttributeId := <font color="#800000">"DT"</font>;<br /> bindDate.UseField := <font color="#008080">True</font>;<br /> bindDate.SourceFieldId := <font color="#800000">"DT"</font>;<br /> <font color="#008000">// Revelance observation attribute binding<br /> </font> bindC := Bs.Add;<br /> bindC.Dictionary := RubricatorDictionary.Values;<br /> bindC.AttributeId := <font color="#800000">"ACT"</font>;<br /> bindC.AttributeName := <font color="#800000">"Revelance"</font>;<br /> bindC.UseField := <font color="#008080">False</font>;<br /> bindC.DataType := DbDataType.Boolean;<br /> bindC.SourceValue := <font color="#008000">1</font>;<br /> bindIndicator.Hidden := <font color="#008080">True</font>;<br /> <font color="#008000">// Specify dimensions calendar<br /> </font> mbObj := mb.ItemById(<font color="#800000">"D_CALEND"</font>);<br /> cr.TemplateCalendar := mbObj.Bind <font color="#008080">As</font> ICalendarDimension;<br /> <font color="#008000">// Specify mesurements dictionary<br /> </font> mbObj := mb.ItemByIdNamespace(<font color="#800000">"MEASURES"</font>, RdsKey);<br /> cr.Measures := mbObj.Bind <font color="#008080">As</font> IRdsDictionary;<br /> <font color="#008000">// Specify mesurement units dictionary<br /> </font> mbObj := mb.ItemByIdNamespace(<font color="#800000">"UNITS"</font>, RdsKey);<br /> cr.Units := mbObj.Bind <font color="#008080">As</font> IRdsDictionary;<br /> <font color="#008000">// Create time series database<br /> </font> cr.CreateRubricator;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> UserProc;
<font color="#008080">Imports</font> Prognoz.Platform.Interop.Cubes;<br /> <font color="#008080">Imports</font> Prognoz.Platform.Interop.Dal;<br /> <font color="#008080">Imports</font> Prognoz.Platform.Interop.Db;<br /> <font color="#008080">Imports</font> Prognoz.Platform.Interop.Dimensions;<br /> <font color="#008080">Imports</font> Prognoz.Platform.Interop.Rds;<br /> …<br /> [STAThread]<br /> <font color="#008080">Public</font> <font color="#008080">Shared</font> <font color="#008080">Sub</font> Main(Params: StartParams);<br /> <font color="#008080">Var</font><br /> mb: IMetabase;<br /> cr: IRubricatorCreator;<br /> CrInfo: IMetabaseObjectCreateInfo;<br /> mbObj: IMetabaseObjectDescriptor;<br /> RdsKey: uinteger;<br /> Bs: IRubricatorCreatorBindings;<br /> bindCountry, bindIndicator: IRubricatorCreatorBinding;<br /> bindDLfacts, bindValues, bindDate, bindC: IRubricatorCreatorBinding;<br /> <font color="#008080">Begin</font><br /> mb := Params.Metabase;<br /> cr := <font color="#008080">New</font> RubricatorCreator.Create();<br /> <font color="#008000">// Specify repository<br /> </font> cr.Metabase := mb;<br /> <font color="#008000">// Specify parameters of created time series database<br /> </font> CrInfo := cr.CreateInfo;<br /> CrInfo.Id := mb.generateId(<font color="#800000">"RUBRICATOR"</font>, <font color="#008000">0</font>);<br /> CrInfo.Name := <font color="#800000">"Time series database"</font>;<br /> CrInfo.Parent := mb.Root;<br /> <font color="#008000">// Specify RDS dictionary<br /> </font> mbObj := mb.ItemById[<font color="#800000">"RDS_REPO"</font>];<br /> RdsKey := mbObj.Key;<br /> cr.RdsDatabase := mbObj.Bind() <font color="#008080">As</font> IRdsDatabase;<br /> <font color="#008000">// Specify data table<br /> </font> mbObj := mb.ItemById[<font color="#800000">"T_TSDB"</font>];<br /> cr.SourceTable := mbObj.Bind() <font color="#008080">As</font> ITable;<br /> <font color="#008000">// Specify attribute bindings<br /> </font> Bs := cr.Bindings;<br /> <font color="#008000">// Factors attribute bindings «Country»<br /> </font> bindCountry := Bs.Add();<br /> bindCountry.Dictionary := RubricatorDictionary.rubdicFacts;<br /> bindCountry.AttributeId := <font color="#800000">"COUNTRY"</font>;<br /> bindCountry.AttributeName := <font color="#800000">"Page"</font>;<br /> bindCountry.UseField := <font color="#008080">True</font>;<br /> bindCountry.SourceFieldId := <font color="#800000">"COUNTRY"</font>;<br /> bindCountry.DataType := DbDataType.ddtInteger;<br /> bindCountry.Kind := (MetaAttributeKind.meakDimension);<br /> bindCountry.ValuesObject := mb.ItemByIdNamespace[<font color="#800000">"DICT_CTR"</font>, RdsKey];<br /> bindCountry.Nullable := <font color="#008080">False</font>;<br /> bindCountry.IsDimension := <font color="#008080">True</font>;<br /> bindCountry.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Indicator factors attribute binding<br /> </font> bindIndicator := Bs.Add();<br /> bindIndicator.Dictionary := RubricatorDictionary.rubdicFacts;<br /> bindIndicator.AttributeId := <font color="#800000">"INDICATOR"</font>;<br /> bindIndicator.AttributeName := <font color="#800000">"Factor"</font>;<br /> bindIndicator.UseField := <font color="#008080">True</font>;<br /> bindIndicator.SourceFieldId := <font color="#800000">"INDICATOR"</font>;<br /> bindIndicator.DataType := DbDataType.ddtInteger;<br /> bindIndicator.Kind := (MetaAttributeKind.meakDimension);<br /> bindIndicator.Tag := MetaAttributeTag.meatNone;<br /> bindIndicator.ValuesObject := mb.ItemByIdNamespace[<font color="#800000">"DICT_IND"</font>, RdsKey];<br /> bindIndicator.Nullable := <font color="#008080">False</font>;<br /> bindIndicator.IsDimension := <font color="#008080">True</font>;<br /> bindIndicator.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Period factors attribute binding<br /> </font> bindDLfacts := Bs.Add();<br /> bindDLfacts.Dictionary := RubricatorDictionary.rubdicFacts;<br /> bindDLfacts.AttributeId := <font color="#800000">"DL"</font>;<br /> bindDLfacts.UseField := <font color="#008080">True</font>;<br /> bindDLfacts.SourceFieldId := <font color="#800000">"DL"</font>;<br /> bindDLfacts.IncludeInIndex := <font color="#008080">True</font>;<br /> <font color="#008000">// Value observation attribute binding»<br /> </font> bindValues := Bs.Add();<br /> bindValues.Dictionary := RubricatorDictionary.rubdicValues;<br /> bindValues.AttributeId := <font color="#800000">"VL"</font>;<br /> bindValues.UseField := <font color="#008080">True</font>;<br /> bindValues.SourceFieldId := <font color="#800000">"VALUE"</font>;<br /> <font color="#008000">// Data observation attribute binding<br /> </font> bindDate := Bs.Add();<br /> bindDate.Dictionary := RubricatorDictionary.rubdicValues;<br /> bindDate.AttributeId := <font color="#800000">"DT"</font>;<br /> bindDate.UseField := <font color="#008080">True</font>;<br /> bindDate.SourceFieldId := <font color="#800000">"DT"</font>;<br /> <font color="#008000">// Revelance observation attribute binding<br /> </font> bindC := Bs.Add();<br /> bindC.Dictionary := RubricatorDictionary.rubdicValues;<br /> bindC.AttributeId := <font color="#800000">"ACT"</font>;<br /> bindC.AttributeName := <font color="#800000">"Currency"</font>;<br /> bindC.UseField := <font color="#008080">False</font>;<br /> bindC.DataType := DbDataType.ddtBoolean;<br /> bindC.SourceValue := <font color="#008000">1</font>;<br /> bindIndicator.Hidden := <font color="#008080">True</font>;<br /> <font color="#008000">// Specify calendar dimension<br /> </font> mbObj := mb.ItemById[<font color="#800000">"D_CALEND"</font>];<br /> cr.TemplateCalendar := mbObj.Bind() <font color="#008080">As</font> ICalendarDimension;<br /> <font color="#008000">// Specify measurements dictionary<br /> </font> mbObj := mb.ItemByIdNamespace[<font color="#800000">"MEASURES"</font>, RdsKey];<br /> cr.Measures := mbObj.Bind() <font color="#008080">As</font> IRdsDictionary;<br /> <font color="#008000">// Specify measurement units dictionary<br /> </font> mbObj := mb.ItemByIdNamespace[<font color="#800000">"UNITS"</font>, RdsKey];<br /> cr.Units := mbObj.Bind() <font color="#008080">As</font> IRdsDictionary;<br /> <font color="#008000">// Create time series DB<br /> </font> cr.CreateRubricator();<br /> <font color="#008080">End</font> <font color="#008080">Sub</font>;
See also:
Fore Example code