SYS(2040) - Detect Report Status
Detects whether a report is being printed or is in preview mode.
SYS(2040)
Return Values
Character data type. Returns the current status of the report as follows.
Value | Description |
---|---|
0 | There is no active report. |
1 | Report is in Preview Mode |
2 | Report is being sent as output (such as a printer or file). |
Remarks
The SYS(2040) function is useful when you want to control content in a report depending on how its being viewed. For example, you can print a message such as "Confidential" or "Classified" but not display it when the report is in Preview Mode.
Example
The following example displays how SYS(2040) can be used to suppress the _PAGETOTAL system variable when the report is in Preview Mode.
"Page: " + TRANS(_PAGENO) + ;
IIF( SYS(2040) = "1", "", " of " + TRANS(_PAGETOTAL))