LevelFormat: MsLevelFormat;
LevelFormat: Prognoz.Platform.Interop.Ms.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsObj: IMetabaseObjectDescriptor;
Problem: IMsProblem;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
ChainEn: IMsCalculationChainEntries;
i: Integer;
ChainVar: IMsCalculationChainVariable;
Begin
mb := Params.Metabase;
// Get modeling container
MsObj := mb.ItemById["MODEL_SPACE"];
// Getnbsp;modelingnbsp;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.mlfLong;
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.mccetVariable Then
ChainVar := ChainEn.Item[i] As IMsCalculationChainVariable;
System.Diagnostics.Debug.WriteLine("Variable: " + ChainVar.Key.ToString());
System.Diagnostics.Debug.WriteLine("source name: " + ChainVar.OriginalName);
System.Diagnostics.Debug.WriteLine(" full name: " + ChainVar.FullName);
End If;
End For;
(Problem As IMetabaseObject).Save();
End Sub;
See also: