LevelFormat: MsLevelFormat;
The LevelFormat property determines the mode of displaying the calendar frequency.
By default the calendar frequency is not displayed, that is, LevelFormat = MsLevelFormat.None.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a modeling problem with the PROBLEM identifier. The task must contain the internal metamodel.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsObj: IMetabaseObjectDescriptor;
Problem: IMsProblem;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
ChainEn: IMsCalculationChainEntries;
i: Integer;
ChainVar: IMsCalculationChainVariable;
Begin
mb := MetabaseClass.Active;
// Get modeling container
MsObj := mb.ItemById("MODEL_SPACE");
// Get modeling problem
Problem := mb.ItemByIdNamespace("PROBLEM", MsObj.Key).Edit As IMsProblem;
// Get metamodel
Meta := Problem.MetaModel;
MetaVisual := Meta.VisualController;
// Set the parameters of displaying the calendar frequency
MetaVisual.LevelFormat := MsLevelFormat.Long;
MetaVisual.UpdateVariables;
// Display names of variables in the console window
ChainEn := Meta.CalculationChain;
For i := 0 To ChainEn.Count - 1 Do
If ChainEn.Item(i).Type = MsCalculationChainEntryType.Variable Then
ChainVar := ChainEn.Item(i) As IMsCalculationChainVariable;
Debug.WriteLine("Variable: " + ChainVar.Key.ToString);
Debug.WriteLine(" there is the source name: " + ChainVar.OriginalName);
Debug.WriteLine("the full name: " + ChainVar.FullName);
End If;
End For;
(Problem As IMetabaseObject).Save;
End Sub UserProc;
Example execution result: calendar frequency is changed for the modeling problem the mode of displaying, different names of variables contained in the problem are displayed in the console window.
See also: