Via the codeunit NCE Connector Excel Evaluations can also be called or integrated from other extensions or from elsewhere.
Currently, 3 functions are available in several variants (or several overloads) for calling an evaluation:
DownloadEvaluation - creates the Excel workbook on your device.
GetEvaluation - works in principle like DownloadEvaluation with the difference that the finished Excel workbook is not downloaded, but returned as a Temp Blob.
In addition, the file name that the Excel Report Builder would assign to the workbook is returned.
ExecuteEvaluation - works in principle like the Execute action.
Note
When calling an evaluation via DownloadEvaluation or GetEvaluation, neither a confirmation page nor a filter page is displayed to the user.
Example 1
On the Customer List page (Page 22), the evaluation 'CUST_ONGOING_DOCS' should be callable via an action. The evaluation should be created and then downloaded.
Implementation
pageextension 50000 "NVX Customer List" extends "Customer List"
{
actions
{
addfirst(Sales)
{
action(NVXCallNCEEvaluationAction)
{
ApplicationArea = All;
Caption = 'Excel Evaluation', Comment = 'DEU="Excel-Auswertung"';
Image = Start;
Scope = Repeater;
ToolTip = 'Executes the CUST_ONGOING_DOCS evaluation. This creates an Excel workbook on your device.', Comment = 'DEU="Führt die CUST_ONGOING_DOCS Auswertung aus. Dadurch wird eine Excel-Arbeitsmappe auf Ihrem Gerät erstellt."';
trigger OnAction()
var
NCEConnector: Codeunit "NCE Connector";
begin
NCEConnector.DownloadEvaluation('CUST_ONGOING_DOCS');
end;
}
}
}
}
Example 2
The same requirement as in example 1, but in addition it should be ensured that the evaluation contains the "Sales Header" table. All changes to example 1 are highlighted.
Implementation
pageextension 50000 "NVX Customer List" extends "Customer List"
{
actions
{
addfirst(Sales)
{
action(NVXCallNCEEvaluationAction)
{
ApplicationArea = All;
Caption = 'Excel Evaluation', Comment = 'DEU="Excel-Auswertung"';
Image = Start;
Scope = Repeater;
ToolTip = 'Executes the CUST_ONGOING_DOCS evaluation. This creates an Excel workbook on your device.', Comment = 'DEU="Führt die CUST_ONGOING_DOCS Auswertung aus. Dadurch wird eine Excel-Arbeitsmappe auf Ihrem Gerät erstellt."';
trigger OnAction()
var
TempNCEConnectorTableFilter: Record "NCE Connector Table Filter" temporary;
NCEConnector: Codeunit "NCE Connector";
begin
Clear(TempNCEConnectorTableFilter);
TempNCEConnectorTableFilter."Table No." := Database::"Sales Header";
TempNCEConnectorTableFilter.Insert();
NCEConnector.DownloadEvaluation('CUST_ONGOING_DOCS', TempNCEConnectorTableFilter);
end;
}
}
}
}
Example 3
The same requirement as in example 1 and 2, but in addition it is to be filtered on sales quotes, sales orders and on the current customer no. All changes to Example 2 are highlighted.
Implementation
pageextension 50000 "NVX Customer List" extends "Customer List"
{
actions
{
addfirst(Sales)
{
action(NVXCallNCEEvaluationAction)
{
ApplicationArea = All;
Caption = 'Excel Evaluation', Comment = 'DEU="Excel-Auswertung"';
Image = Start;
Scope = Repeater;
ToolTip = 'Executes the CUST_ONGOING_DOCS evaluation. This creates an Excel workbook on your device.', Comment = 'DEU="Führt die CUST_ONGOING_DOCS Auswertung aus. Dadurch wird eine Excel-Arbeitsmappe auf Ihrem Gerät erstellt."';
trigger OnAction()
var
SalesHeader: Record "Sales Header";
TempNCEConnectorTableFilter: Record "NCE Connector Table Filter" temporary;
NCEConnector: Codeunit "NCE Connector";
begin
Rec.TestField("No.");
Clear(TempNCEConnectorTableFilter);
TempNCEConnectorTableFilter."Table No." := Database::"Sales Header";
TempNCEConnectorTableFilter."Field No." := SalesHeader.FieldNo("Document Type");
TempNCEConnectorTableFilter.Filter := StrSubstNo('%1|%2', SalesHeader."Document Type"::Quote, SalesHeader."Document Type"::Order);
TempNCEConnectorTableFilter.Insert();
Clear(TempNCEConnectorTableFilter);
TempNCEConnectorTableFilter."Table No." := Database::"Sales Header";
TempNCEConnectorTableFilter."Field No." := SalesHeader.FieldNo("Sell-to Customer No.");
TempNCEConnectorTableFilter.Filter := Rec."No.";
TempNCEConnectorTableFilter.Insert();
NCEConnector.DownloadEvaluation('CUST_ONGOING_DOCS', TempNCEConnectorTableFilter);
end;
}
}
}
}
Filter
Filters are passed to the NCE Connector via the (temporary) NCE Connector Table Filter table - see Example 3.
When calling the ExecuteEvaluation function, the Filter Type can be set via TempNCEConnectorTableFilter."Filter Type".
For more information, see Edit Evaluations, Data Sheets, Table Settings.
Note
If there are any overlaps with the filters specified in the Excel Evaluation, these will be overwritten.
If filters are passed for a table that occurs more than once in the Excel Evaluation, the filters are set for all tables.