次の方法で共有


SYS(2024) - Detect Report Cancellation

This function provides information about whether a report finished normally or was cancelled.

SYS(2024)

Parameters

None.

Return Value

Character. Returns "Y" if the current report was interrupted before processing its full data scope. Returns "N" if there is no current report or if the current report has not been interrupted.

Remarks

A report is considered "interrupted" by the Visual FoxPro Report System if one of the following actions occur:

  1. The report is running in object-assisted reporting mode, and a program invokes a ReportListener CancelReport method before the report is completely processed. For more information, see CancelReport Method.

  2. A user presses ESC or the Cancel button in backward-compatible reporting mode. When this happens, the SYS(2024) value is available to the report engine internally, although there may be no way for users to access the value.

  3. A program error occurs in code running during a report, whether in a user-defined function or ReportListener methods, and the user opts to Cancel from the resulting error dialog box.

During an interrupted report, SYS(2024) continues to return "Y" until after the complete sequence of report events. The return value of this function is reset to "N" after the UnloadReport Event finishes. For more information, see UnloadReport Event.

Example

The following example code is from the utilityReportListener class, which is responsible for file-handling procedures. When it closes a file at the conclusion of a report run, it checks to see what type of message should be displayed to the user regarding the success or failure of the report run. If the report run did not have any errors, the class uses SYS(2024) to determine whether the results of the report run are complete before assembling an appropriate message. For more information about this class, see ReportListener Utility and File-handling Foundation Class.

* excerpted from 
* utilityReportListener.closeTargetFile method
IF THIS.HadError
   THIS.DoMessage(OUTPUTCLASS_CREATEERRORS_LOC, ;
                  MB_ICONEXCLAMATION )
ELSE
   THIS.DoMessage( OUTPUTCLASS_SUCCESS_LOC + ;
                   IIF(SYS(2024)="Y", ;
                   CHR(13)+OUTPUTCLASS_REPORT_INCOMPLETE_LOC,""),;
                   MB_ICONINFORMATION)
ENDIF

See Also

Concepts

Understanding Visual FoxPro Object-Assisted Reporting