Hi,
I have extended Sales - Shipment’s report’s request page adding a boolean. Is it possible to load it’s value from Rec before the request page is shown?
I’ve tried some triggers like “OnOpenPage” but it doesn’t contain the Rec yet.
OnPreDataItem executes after the request page...
I show you the code:
reportextension 50345 SShipReportExt extends "MGS Sales - ShipmentV2" { RDLCLayout = './src/Report/Layouts/StandardSShipmentExtended.rdl'; dataset { add("Sales Shipment Header") { column(Valueless; Valueless) { } } modify("Sales Shipment Header") { trigger OnBeforePreDataItem() var begin //It's not executing this code before the request page Message('test'); end; } } requestpage { layout { addlast(Options) { field(Valueless; Valueless) { ApplicationArea = all; Caption = 'Valueless'; ToolTip = 'Hides values from shipment lines'; } } } } var Valueless: Boolean; }
Any idea?
Thank you!
Its not possible to run the trigger before the OnRequestPage Open. Either you can create a Global function in that report extension and call that functions before running the report and pass the parameter into that function
Globalfunction(FieldValue)
Begin
somestatement
End;
Run this report on action button
ReportVAR.Globalfunction(Rec.FieldValue)
ReportVAR.run()
and use that Rec.FieldValue same place you want to use in your extension.
Thanks.
Thanks for replying. I've edited the question adding the whole code.
You mean assigning the value from the Rec at OnOpenPage? I couldn't get the Rec at first, because it doesn't exist.
But while I was replying you, I tried to get the filter from the header and I finally got it or kind of. Thank you!
The problem is that it's executed before the request page and after it, so it replaces the value if it's changed by the user...
I share the code in case someone needs it:
//Report Extension from Sales - Shipment //Goal: Get Rec of the report before the RequestPage //This trigger is inside requestpage trigger OnOpenPage() var Albaran: Record "Sales Shipment Header"; NoAlbaran: Text; begin //Here you get the No from the filter NoAlbaran := "Sales Shipment Header".GetFilter("No."); //With the No you can do the logic you need, this is an example if Albaran.get(NoAlbaran) then begin Valueless := Cliente.PQNAlbaranValorado; end; end;
Hi,
Try to put CurrReport.UseRequestPage(); after assigning the value OnOPenpage of Request page.
or show us you complete code, how you are looking for?
Thanks for replying.
It's not what i wanted but it's an alternative solution.
However, the field appears empty, and I don't know how to fill it. Do I have to do something more apart from "RequestFilterFields = MyField"?
Thank you
Hello, thanks for replying.
I've tried your solution but OnPreDataItem triggers after the request page. I've tried the rest of triggers too (OnBeforePostDataItem OnAfterPost...), and all of them trigger after the page.
This is what I wrote:
modify("Sales Shipment Header") { // Mohana's answer RequestFilterFields = PQNValueless; trigger OnBeforePreDataItem() begin Message('test'); end; }
Please add the field to the requestfilterfields and fill like the standard No. and Bill-to Customer No.
Yes, it is possible to load the value of the boolean field from the record before the request page is shown. You can use the OnPreDataItem trigger to achieve this. Here's an example code snippet that should work for your scenario:
trigger OnPreDataItem()
var
Rec: Record "Sales Shipment Header";
OptionsField: Field "Sales Shipment Header".Options;
begin
Rec := Rec;
OptionsField.Value := Rec.Valueless;
end;
This code will run before the request page is shown and it will load the value of the "Valueless" field from the record into the "Options" field on the request page. You can then use the "Options" field in your report to hide or show the values from the shipment lines based on the user's selection.
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,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156