EditTemporary: IMetabaseObject;
EditTemporary(): Prognoz.Platform.Interop.Metabase.IMetabaseObject;
The EditTemporary method opens the object for temporary change of properties.
The object can not be used in this mode. The "Object is not in the state of editing" error is generated during the saving.
Executing the example requires a form, a button positioned on it with the Button1 identifier, the ModelBox component and the UiModel component with the UiModel1 identifier that is the data source for ModelBox. The repository contains a modeling container with the CONT_MODEL identifier and a model created in it with the MODEL identifier.
Add links to the Metabase, Ms system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
ContKey: Integer;
Model: IMsModel;
Begin
MB := MetabaseClass.Active;
ContKey := MB.ItemById("CONT_MODEL").Key;
Model := MB.ItemByIdNamespace("MODEL", ContKey).EditTemporary As IMsModel;
UiModel1.Active := False;
UiModel1.Model := Model;
UiModel1.Active := True;
End Sub Button1OnClick;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
MB: IMetabase;
ContKey: Integer;
Model: IMsModel;
Begin
MB := Self.Metabase;
ContKey := MB.ItemById["CONT_MODEL"].Key As Integer;
Model := MB.ItemByIdNamespace["MODEL", ContKey As UInteger].EditTemporary() As IMsModel;
uiModelNet1.Active := False;
uiModelNet1.Model := Model;
uiModelNet1.Active := True;
End Sub;
The MODEL model is opened in the ModelBox component after executing this example. Parameters of the model can be edited but they can not be saved.
See also: