Slice: IMsFormulaTransformSlice;
Slice: Prognoz.Platform.Interop.Ms.IMsFormulaTransformSlice;
The Slice property determines the variable slice.
To get information about the fact whether the variable is internal for the calculation chain, use the IMsCalculationChainVariable.IsInternal property.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a modeling problem with the WEB_PROBLEM identifier. The task must contain the internal metamodel.
Add links to the Metabase, Ms system assemblies.
Sub ChainEntry;
Var
mb: IMetabase;
msKey: Integer;
Problem: IMsProblem;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
ChainEnts: IMsCalculationChainEntries;
i: Integer;
ChainEl: IMsCalculationChainEntry;
ChainVar: IMsCalculationChainVariable;
Begin
mb := MetabaseClass.Active;
// Get modelling container key
msKey := mb.GetObjectKeyById("MODEL_SPACE");
// Getnbsp;modelingnbsp;problem
Problem := mb.ItemByIdNamespace("WEB_PROBLEM", msKey).Bind As IMsProblem;
// Get metamodel
Meta := Problem.MetaModel;
MetaVisual := Meta.VisualController;
// Get metamodel calculation chain
ChainEnts := Meta.CalculationChain;
For i := 0 To ChainEnts.Count - 1 Do
ChainEl := ChainEnts.Item(i);
// Display information only about variables
If ChainEl.Type = MsCalculationChainEntryType.Variable Then
ChainVar := ChainEl As IMsCalculationChainVariable;
Debug.WriteLine("Name: " + ChainVar.Slice.Name);
Debug.WriteLine("Internal variable: " + ChainVar.IsInternal.ToString);
Debug.WriteLine("");
End If;
End For;
End Sub ChainEntry;
After executing the example the information about variables contained in the metamodel calculation chain will be 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;
msKey: uinteger;
Problem: IMsProblem;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
ChainEnts: IMsCalculationChainEntries;
i: Integer;
ChainEl: IMsCalculationChainEntry;
ChainVar: IMsCalculationChainVariable;
Begin
mb := Params.Metabase;
// Get modelling container key
msKey := mb.GetObjectKeyById("MODEL_SPACE");
// Getnbsp;modelingnbsp;problem
Problem := mb.ItemByIdNamespace["WEB_PROBLEM", msKey].Bind() As IMsProblem;
// Get metamodel
Meta := Problem.MetaModel;
MetaVisual := Meta.VisualController;
// Get metamodel calculation chain
ChainEnts := Meta.CalculationChain;
For i := 0 To ChainEnts.Count - 1 Do
ChainEl := ChainEnts.Item[i];
// Display information only about variables
If ChainEl.Type = MsCalculationChainEntryType.mccetVariable Then
ChainVar := ChainEl As IMsCalculationChainVariable;
System.Diagnostics.Debug.WriteLine("Name: " + ChainVar.Slice.Name);
System.Diagnostics.Debug.WriteLine("Internal variable: " + ChainVar.IsInternal.ToString());
System.Diagnostics.Debug.WriteLine("");
End If;
End For;
End Sub;
See also: