I have modified the Bin Contents List (Page #7305) from the Sales Order Subform to include a boolean field from the Bins Table (different table) that identifies if the Bin is flagged as "Include in Qty Available" calculation.
Using the OnAfterGetRecord trigger, I am able to successfully add the boolean field and see which Bins have the flag set to True. Code and page are below.
Next step I want to do is limit the Bin Contents List results to only the ones where the boolean field is true. I have tried several methods to do this but nothing works.
Normally I would use a SETFILTER on the OnOpenPage trigger, but since the boolean field is from another table and is evaluated on the OnAfterGetRecord trigger, I think that is too early in the code.
What additional code do I need to set the filter when the page is opened?
pageextension 50125 BinContentsListPageExt extends "Bin Contents List"
{
layout
{
addafter(Dedicated)
{
field(InclQtyAvail; InclQtyAvail)
{
Caption = 'Incl. Qty Avail';
ApplicationArea = All;
Enabled = false;
}
}
}
var
BinTable: Record Bin;
InclQtyAvail: Boolean;
trigger OnAfterGetRecord()
begin
BinTable.Reset();
BinTable.SetRange("Location Code", Rec."Location Code");
BinTable.SetRange("Code", Rec."Bin Code");
InclQtyAvail := false;
if BinTable.FindFirst() then begin
InclQtyAvail := BinTable.InclQtyAvail;
end;
end;
}