Indicates whether a report is being printed in preview mode.

IsPreview := PREVIEW

Property Value/Return Value

Type: Boolean

true if the report is run in preview mode; otherwise, false.

Remarks

You must use the return value. A compile error is generated if this value is not used.

In the Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Web client, if you run a client report definition (RDLC) report layout in preview mode and then call the CurrReport.PREVIEW function, then the Print icon, Print Layout icon, Page Setup icon, and Save As icon are not displayed.

If you run a client report definition (RDLC) report layout in preview mode and do not call the CurrReport.PREVIEW function, then you can print from the Print Preview window.

The following illustration shows the Print icon in the Microsoft Dynamics NAV Windows client Print Preview window.

RDLC report print icon

Example

This example shows how to use the PREVIEW function. You can use this function in an application that stores a count of how many times a document has been printed in the database. This number must be updated from inside the report that is used to print the document. To avoid updating the number when the report is run in preview mode, add a construct to the OnPreDataItem trigger that resembles the one that is shown in this example when you add the code that updates the count.

Copy Code
IF CurrReport.PREVIEW THEN
... // Preview-specific processing.
ELSE
... // Processing that is not preview specific:
... // Update the print count.

See Also