HasVariableRubricator: Boolean;
The HasVariableRubricator property determines whether a metamodel has the internal time series database.
Available values:
True. The metamodel contains internal time series database.
False. The metamodel does not contain internal time series database.
On setting HasVariableRubricator to True, the internal time series database and the dictionary used to store internal variables names are created automatically. If the False value is set, and there are no models, built on the internal time series database, the dictionary and the database are deleted, otherwise the exception is thrown.
Executing the example requires:
Time series database with the TSDB identifier containing a time series with the 12 key
A modeling container with THE MS identifier, containing a metamodel with the META identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub HasVariableRubricator;
Var
mb: IMetabase;
RubObj: IMetabaseObjectDescriptor;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
VarInp, VarOutp: IMsCalculationChainVariable;
VarEx: Boolean;
InVarKey, InModelKey: Integer;
InpKeys: Array[1] Of Integer;
SimpleModel: IMsModel;
Begin
mb := MetabaseClass.Active;
// Get time series database
RubObj := mb.ItemById("TSDB");
// Get metamodel
Meta := mb.ItemByIdNamespace("META", mb.ItemById("MS").Key).Edit As IMsMetaModel;
MetaVisual := Meta.VisualController;
// If necessary, then create the internal time series database for the metamodel
If Not MetaVisual.HasVariableRubricator Then
MetaVisual.HasVariableRubricator := True;
End If;
// Get the key of the input variable
VarInp := MetaVisual.GetVariableByFactor(RubObj.Key, 12, "", VarEx);
InpKeys[0] := VarInp.Key;
// Create output variable
VarOutp := MetaVisual.CreateVariable("Internal output variable", "", DimCalendarLevel.Year, VarEx);
// Create the internal model
SimpleModel := MetaVisual.CreateSimpleModel(-1, InpKeys, VarOutp.Key, MsFormulaKind.LinearRegression, "", InVarKey, InModelKey, -1, -1, True);
// Add the internal variable as the factor to the model
MetaVisual.AddFactor(SimpleModel, VarOutp.Key, "", InVarKey, InModelKey, -1);
// Display model name in the console window
Debug.WriteLine(SimpleModel.CreateStringGenerator.Execute);
// Save metamodel
(Meta As IMetabaseObject).Save;
End Sub HasVariableRubricator;
Example execution result: the internal model of linear regression containing two factors will be created in the META metamodel. Model is calculated by R. Name of the model is displayed in the console window.
See also: