IDataChange.SaveData

Syntax

SaveData([CallBack: ICubeCallback = Null]);

Parameters

CallBack.Object that handles errors that may occur on saving data.

Description

The SaveData method saves modified values of data area(s) to source(s).

Example

Executing the example requires a form with a button on the form, a button named Button1, the ReportBox component and the UiReport component named UiReport1.

Class TestForm: Form
    UiReport1: UiReport;
    ReportBox1: ReportBox;
    Button1: Button;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Report: IPrxReport;
        Sheet: IPrxSheet;
        DataChage: IPrxDataChange;
        Callback: CubeCallback;
    Begin
        Report := UiReport1.Instance As IPrxReport;
        Sheet := Report.ActiveSheet;
        DataChage := Sheet As IPrxDataChange;
        If DataChage.IsDataChanged Then
            Callback := New CubeCallback.Create;
            DataChage.SaveData(Callback);
            Callback := Null;
        End If;
    End Sub Button1OnClick;

End Class TestForm;

Class CubeCallback: Object, ICubeCallback
    Public Sub OnCallback(Argument: ICubeCallbackArgument);
    Begin
        Debug.WriteLine("Error: " + Argument.Error.Message);
        Debug.WriteLine("Error identifier: " + Argument.Error.MessageID.ToString);
        Debug.WriteLine("Source: " + Argument.Error.Source);
        Argument.IgnoreError := True;
    End Sub OnCallback;
    
    Public Function get_Argument: ICubeCallbackArgument;
    Begin
        Return Null;
    End Function get_Argument;
End Class CubeCallback;

Executing the example and clicking the button saves modified values of all data areas of active report sheet. An object of the CubeCallback class is used to handle errors that may occur while saving data. All errors will be ignored. Information on errors will be displayed in the development environment console.

See also:

IDataChange