RemoveByKey(Key: Integer): Boolean;
Key. Series key.
The RemoveByKey method removes a series by the specified key. The method returns True if the series is successfully removed; otherwise it returns False.
Executing the example requires a form with the Button1 button, the IntegerEdit component named IntegerEdit1 (for a Fore.NET example the numericUpDown component named numericUpDown1). There must be a regular report with the REGULAR_REPORT identifier, which sheet houses a 3D scene with several data series. Add links to the Metabase Report, Tab, Ui, Forms, Forms.Net (for Fore.NET example) assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Report: IPrxReport;
S: IPrxScene3D;
Series: IPrxScene3DSeries;
MB: IMetabase;
Tab: ITabSheet;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REGULAR_REPORT").Edit As IPrxReport;
Tab := (Report.Sheets.Item(0) As IPRxTable).TabSheet;
S := Tab.Objects.Item(0).Extension As IPrxScene3D;
Series := S.Series;
If Series.RemoveByKey(IntegerEdit1.Value) Then
WinApplication.InformationBox("Object is removed");
Else
WinApplication.InformationBox("Removal error");
End If;
(Report As IMetabaseObject).Save;
End Sub Button1OnClick;
Enter the series key into the row and click the button. After executing the example the appropriate message is displayed.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Ui;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Report: IPrxReport;
S: IPrxScene3D;
Series: IPrxScene3DSeries;
MB: IMetabase;
Tab: ITabSheet;
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Begin
MB := Self.Metabase;
Report := MB.ItemById["REGULAR_REPORT"].Edit() As IPrxReport;
Tab := (Report.Sheets.Item[0] As IPRxTable).TabSheet;
S := Tab.Objects.Item[0].Extension As IPrxScene3D;
Series := S.Series;
If Series.RemoveByKey(Convert.ToUInt32(numericUpDown1.Value)) Then
WinApp.InformationBox("Object is removed", Null);
Else
WinApp.InformationBox("Removal error", Null);
End If;
(Report As IMetabaseObject).Save();
End Sub;
See also: