In the ForNAV Designer, you can add new data items to a layout without modifying the underlying AL-code. This has the benefit of easy deployment and maintenance, because the changes only exist in custom layout, which is data and not code.
Data items require temporary tables to run and custom AL-logic to fill up the table. You can do this in the ForNAV Designer by adding a new data item to a custom layout:
When the report runs, the OnForNAVFillTemporaryTable event is called (just before OnPreDataItem) to fill up the table and the data item executes like any normal data item.
The OnForNAVFillTemporaryTable event has the following parameters:
- ReportID – the number of the report.
- ChildDataItemId – the name of the virtual data item.
- ParentRecRef – a RecordRef to the parent (or sibling) data item.
- TempRefRec – a RecordRef to the temporary table to fill.
- IsHandled – set to true to disable normal ForNAV behavior.
The following example fills a VAT Amount Line temporary table with the VAT specification from the Header, which is the parent data item:
[EventSubscriber(ObjectType::CodeUnit, Codeunit::"ForNAV TempTable",'OnForNAVFillTemporaryTable', '', false, false)]local procedure OnForNAVFillTemporaryTable(ReportID: Integer;ChildDataItemId: Text; ParentRecRef: RecordRef;var TempRecRef: RecordRef ; var IsHandled: Boolean)varVATAmountLine: Record "VAT Amount Line" temporary;TestValidDociFace: Codeunit "ForNAV Test Valid Doc iFace";DocLineBuffer: Record "ForNAV Document Line Buffer" temporary;LineRec: RecordRef;beginif TempRecRef.Number = Database::"VAT Amount Line" then beginif TestValidDociFace.CheckValid(ParentRecRef) then beginFindLinesRecRef(DocLineBuffer, ParentRecRef, LineRec);TempRecRef.SetTable(VATAmountLine);CreateVATAmountLine(DocLineBuffer, VATAmountLine);TempRecRef.Copy(VATAmountLine, true);end;end;end;
Out of the box, the ForNAV Customizable Report Pack comes with event subscribers to create:
- Assembly Line
- Bank Account information from currency code
- Item Attribute Value Selection
- Tracking Specification
- Payment Service Setup
- Sales Tax Buffer
- VAT Amount Line
- Aggregated General Ledger Entries
- Aggregated Customer Ledger Entries
- Aggregated Vendor Ledger Entries
- Aggregated Item Ledger Entries
- Aggregated Value Entries
- Repeater Line
A prerequisite is that ForNAV 220.127.116.116 and the Customizable Report Pack 18.104.22.168 or later is installed.