TransparentDimensionsCount: Integer;
TransparentDimensionsCount: integer;
The TransparentDimensionsCount property returns the number of hidden dimensions in the variable.
Executing the example requires that repository contains time series database with the FC_PARAM identifier. The base contains the COUNTRY attribute referring to the dictionary. The database modeling container contains metamodel with the METAMODEL identifier and model with the MODEL identifier. The parameter referring to the same dictionary as the COUNTRY attribute is set for the metamodel. Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Catalog: IRubricator;
Transforms: IMetabaseObjectDescriptor;
MetaModel: IMsMetaModel;
Model: IMsModel;
Transform: IMsFormulaTransform;
Input: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
Sel: IDimSelectionSet;
Atts: IMetaAttributes;
Dict: IMetabaseObjectDescriptor;
dimInst: IDimInstance;
dimSel: IDimSelection;
Params: IMsModelParams;
paramDim: IMsParametrizedDimensions;
paramD: IMsParametrizedDimension;
pr: IMsModelParam;
Coord: IMsFormulaTransformCoord;
Begin
// Get repository
mb := MetabaseClass.Active;
// Get TSDM
Catalog := mb.ItemById("FC_PARAM").Bind As IRubricator;
// Get modeling container
Transforms := Catalog.ModelSpace;
// Get metamodel and model
MetaModel := mb.ItemByIdNamespace("METAMODEL", Transforms.Key).Bind As IMsMetaModel;
Model := mb.ItemByIdNamespace("MODEL", Transforms.Key).Edit As IMsModel;
// Set up model parameters
Transform := Model.Transform;
Input := Transform.Inputs.Item(0);
Slice := Input.Slices.Item(0);
Sel := Slice.Selection;
Atts := Catalog.Facts.Attributes;
Dict := Atts.FindById("COUNTRY").ValuesObject;
dimInst := Dict.Open(Null) As IDimInstance;
dimSel := Sel.Add(dimInst);
dimSel.SelectElement(0, False);
// Set up metamodel parameters
Params := MetaModel.Params;
pr := Params.Item(0);
paramDim := Slice.ParametrizedDimensions;
paramD := paramDim.Item(0);
paramD.ParamAttributes.Parameter := pr;
Debug.WriteLine("Dimension name: " + paramD.DimensionDescriptor.Name);
Debug.WriteLine("Dimension description: " + (paramD.Dimension As IMetabaseObject).Description);
Coord := Transform.CreateCoord(Transform.Outputs.Item(0));
If Coord.TransparentDimensionsCount > 0 Then
Debug.WriteLine("Output variable contains hidden dimensions");
End If;
(Model As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Catalog: IRubricator;
Transforms: IMetabaseObjectDescriptor;
MetaModel: IMsMetaModel;
Model: IMsModel;
Transform: IMsFormulaTransform;
Input: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
Sel: IDimSelectionSet;
Atts: IMetaAttributes;
Dict: IMetabaseObjectDescriptor;
dimInst: IDimInstance;
dimSel: IDimSelection;
Paramss: IMsModelParams;
paramDim: IMsParametrizedDimensions;
paramD: IMsParametrizedDimension;
pr: IMsModelParam;
Coord: IMsFormulaTransformCoord;
Begin
// Get repository
mb := Params.Metabase;
// Get TSDM
Catalog := mb.ItemById["FC_PARAM"].Bind() As IRubricator;
// Get modeling container
Transforms := Catalog.ModelSpace;
// Get metamodel and model
MetaModel := mb.ItemByIdNamespace["METAMODEL", Transforms.Key].Bind() As IMsMetaModel;
Model := mb.ItemByIdNamespace["MODEL", Transforms.Key].Edit() As IMsModel;
// Set up model parameters
Transform := Model.Transform;
Input := Transform.Inputs.Item[0];
Slice := Input.Slices.Item[0];
Sel := Slice.Selection;
Atts := Catalog.Facts.Attributes;
Dict := Atts.FindById("COUNTRY").ValuesObject;
dimInst := Dict.Open(Null) As IDimInstance;
dimSel := Sel.Add(dimInst);
dimSel.SelectElement(0, False);
// Set up metamodel parameters
Paramss := MetaModel.Params;
pr := Paramss.Item[0];
paramDim := Slice.ParametrizedDimensions;
paramD := paramDim.Item[0];
paramD.ParamAttributes.Parameter := pr;
System.Diagnostics.Debug.WriteLine("Dimension name: " + paramD.DimensionDescriptor.Name);
System.Diagnostics.Debug.WriteLine("Dimension description: " + (paramD.Dimension As IMetabaseObject).Description);
Coord := Transform.CreateCoord(Transform.Outputs.Item[0]);
If Coord.TransparentDimensionsCount > 0 Then
System.Diagnostics.Debug.WriteLine("Output variable contains hidden dimension");
End If;
(Model As IMetabaseObject).Save();
End Sub;
After executing the example parameterized dimension will be set for model variable slice. Information about it is displayed in the console window. If the output variable of the model contains hidden dimensions, the data about it is also displayed in the console.
See also: