ResetMetaModel;
ResetMetaModel();
The ResetMetaModel method resets metamodel in the calculation chain.
Use the method, if model parameters in repository have been changed and it should be refreshed in the calculation chain.
Executing the example requires that the repository contains a modeling container with the MS identifier. This container must contain metamodel with the CALCULATIONCHAIN identifier calculating metamodel with the METAMODEL_CONVERT identifier in the calculation chain.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
msKey: Integer;
MetaModel: IMsMetaModel;
CalculationChain: IMsCalculationChainEntries;
ChainMetaModel: IMsCalculationChainMetaModel;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modeling container key including metamodel
msKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace("CALCULATIONCHAIN", msKey).Edit As IMsMetaModel;
// Get metamodel calculation chain
CalculationChain := MetaModel.CalculationChain;
// Find metamodel by identifier in the calculation chain
ChainMetaModel := CalculationChain.FindById("METAMODEL_CONVERT") As IMsCalculationChainMetaModel;
// Reset found metamodel
ChainMetaModel.ResetMetaModel;
// Save changes
(MetaModel As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, the METAMODEL_CONVERT is reset in the calculation chain.
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;
MetaModel: IMsMetaModel;
CalculationChain: IMsCalculationChainEntries;
ChainMetaModel: IMsCalculationChainMetaModel;
Begin
// Get current repository
mb := Params.Metabase;
// Get modeling container key including metamodel
msKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace["CALCULATIONCHAIN", msKey].Edit() As IMsMetaModel;
// Get metamodel calculation chain
CalculationChain := MetaModel.CalculationChain;
// Find metamodel by identifier in the calculation chain
ChainMetaModel := CalculationChain.FindById("METAMODEL_CONVERT") As IMsCalculationChainMetaModel;
// Reset found metamodel
ChainMetaModel.ResetMetaModel();
// Save changes
(MetaModel As IMetabaseObject).Save();
End Sub;
See also: