Hi All,
I am new to this, so please bear with me if I have not mentioned all the information needed to get proper help. I have built a table extension that adds two custom fields to the company information table in business central. Then I added these field to a page through the page extension. The last step for me would be to add these fields to the report dataset of the sales Invoice report 1306. My work so far has the added fields present in the report dataset. The only problem seems to be that the fields, which do have a value, do not show the value.
Important Notes on what I have already looked at:
I have seen that report 1306 uses a procedure on the report Init() trigger.
CompanyInfo.Get()
Furthermore, any fields in the header are being populated by a procedure. The table header has been split into two dataItems (LeftHeader & RightHeader). I am guessing I have to subscribe to the right trigger to add my two custom fields being populated. I however, cannot seem to figure out what trigger or triggers I need to use to add my two custom fields.
This goes back to the FillLeftHeader() Procedure
The code I wrote is below:
Table Extension
tableextension 50100 CribNoExt extends "Company Information" { fields { // Add changes to table fields here field(101; Company_Crib_No; Text[20]) { Caption = 'Crib No.'; } field(102; Company_Kvk_No; Text[20]) { Caption = 'Kvk No.'; } field(103; "Bank Name 2"; Text[20]) { Caption = 'Bank Name 2'; } field(104; "Bank Account No 2"; Text[20]) { Caption = 'Bank Account No 2'; } } var myInt: Integer; }
Page extension:
pageextension 50102 CribNoPage extends "Company Information" { layout { // Add changes to page layout here addafter("Industrial Classification") { field(CribNo; Rec.Company_Crib_No) { ApplicationArea = all; } field(KvkNo; Rec.Company_Kvk_No) { ApplicationArea = all; } } addafter("Bank Account No.") { field("Bank Name 2"; Rec."Bank Name 2") { ApplicationArea = all; } field("Bank Account No 2"; Rec."Bank Account No 2") { ApplicationArea = all; } } } actions { // Add changes to page actions here } var myInt: Integer; }
Report Extension:
reportextension 50103 CribNoKvK extends "Standard Sales - Invoice" { dataset { // Add changes to dataitems and columns here add(Header) { column(Company_Crib_No; companyInfoExt.Company_Crib_No) { } column(Company_Kvk_No; companyInfoExt.Company_Kvk_No) { } } } Var myInt: Integer; myCribNo: text[20]; companyInfoExt: Record "Company Information"; company_crib_no_lbl: Label 'Crib No'; company_kvk_no_lbl: Label 'Kvk No'; }
IN conclusion I want to know is this possible? and if not is the only other solution to create a completely new report? This is quite a complex report to just copy and then edit. I would rather extend it.
Thank you NorthW for the explanation and reference!
Maybe this is helpful ?
learn.microsoft.com/.../devenv-get-find-and-next-methods
Normally when you use the Get method you will add parameters for the primary key of the record you want to get.
But if you use Get.() with no parameteres the function will get the first record in the table. And because there are only one record in the companyinformation table the get.() with out parameteres will work fine here.
NorthW It worked!
Do you have a reference for me for the .get() function? I did not get that the .Get() (method or function) is a standard function of some sort. Which made it a lot more complicated for me to figure out.
In any case this is the solution to my problem! Thank yo very much!
Hi NorthW ,
Thank for the reply. I will try this and circle back if that worker for me.
You need to run a get on your CompanyInfoExt variable in a on pre report trigger as described here.
Try to add that trigger to your report and do a CompanyInfoExt.Get() within that trigger.
You can do this in a learn.microsoft.com/.../devenv-onprereport-report-trigger
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156