HasCustomLayout Function

Determines whether a report is currently set up to use a custom Word layout or RDLC layout at run time.

Syntax


HasCustomLayout(ObjectType : 'Report'; ObjectID : Integer) : Integer  

Parameters

ObjectType
Type: Option

The Dynamics NAV object type that is run. Currently only the Report value is supported.

ObjectID
Type: Integer

The ID of the Dynamics NAV report object.

Return Value

Type: Integer

The following values are available.

Value Description
0 The report is not currently set up to use a custom RDLC or Word layout.
1 The report is currently set up to use a custom RDLC layout.
2 The report is currently set up to use a custom Word layout.

Applies To

Report layout implementation in codeunit 1 ApplicationManagement.

Remarks

This function is executed when a report is run from the Dynamics NAV client or by a call to the Run, SaveAsWord, SaveAsPdf, and SaveAsExcel functions. The HasCustomLayout function is executed at run time before the OnPreReport Trigger.

Example

The following example shows the default implementation on the function in codeunit 1. This example uses a variable ReportLayout that has the data type Record and subtype Report Layout.

IF ObjectType <> ObjectType::Report THEN  
    ERROR(NotSupportedErr);  

IF ReportLayout.GetActiveReportLayout(ObjectID,ReportLayout.Type::RDLC) THEN  
    EXIT(1);  
IF ReportLayout.GetActiveReportLayout(ObjectID,ReportLayout.Type::Word) THEN  
    EXIT(2);  
EXIT(0);  

See Also

Customizing Report Layout Implementation in Codeunit 1
REPORT.RUN Function
SAVEASWORD Function (REPORT)
SAVEASPDF Function (Report)
SAVEASEXCEL Function (Report)