Hi,
In a below code I created one custome page Bin Data and my source table is "Item Ledger Entry". I am getting right value in a bin data QtyAvail field. If I have ten rows in bin data with same item no (Item1234) then it's updating QtyAvail in each row of list. However, I wanted to update value in last row each time, not in all rows. Could you help me where I am doing wrong.
page 50118 BinDataPage
{
AdditionalSearchTerms = 'inventory transactions';
ApplicationArea = Basic, Suite;
Caption = 'Bin Data';
DataCaptionExpression = GetCaption;
DataCaptionFields = "Item No.";
Editable = false;
PageType = List;
PromotedActionCategories = 'New,Process,Report,Entry';
SourceTable = "Item Ledger Entry";
SourceTableView = SORTING("Entry No.")
ORDER(Descending) where("Entry Type" = filter('Positive Adjmt.|Purchase'));
UsageCategory = History;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("Entry Type"; "Entry Type")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies which type of transaction that the entry is created from.';
}
field("Item No."; "Item No.")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the number of the item in the entry.';
}
field("Posting Date"; "Posting Date")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the quantity in the Quantity field that remains to be processed.';
Visible = true;
Caption = 'Posting Date';
}
field(QtyAvail; RemQtyILE)
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the Qty. Available in the field that links to Reservation entries table quantity field.';
Visible = true;
Caption = 'Qty. Available';
trigger OnValidate()
begin
CurrPage.Update();
end;
}
}
}
}
trigger OnAfterGetRecord()
var
ItemAttr: Record Item;
ItemLedEntry: Record "Item Ledger Entry";
begin
ItemAttr.Reset;
ItemAttr.SetRange("No.", "Item No.");
If ItemAttr.findfirst then begin
ItemAttr.CALCFIELDS(Inventory);
Inv := ItemAttr.Inventory;
ItemAttr.CALCFIELDS("Qty. on Sales Order");
qtySO := ItemAttr."Qty. on Sales Order";
RemQty := Inv - qtySO;
end;
if ItemAttr."No." <> ItemLedEntry."Item No." then begin
If ItemLedEntry.FIND('-') then begin
repeat
until ItemLedEntry.Next = 0;
RemQtyILE := RemQty;
end
end;
end;
var
ItemAttr: Record Item;
RemQty: Decimal;
RemQtyILE: Decimal;
Inv: decimal;
qtySO: Decimal;
}
I am getting 972. in each row. I wanted it only in last row in last entry each time. Any help.