I'm trying to populate a Temporary Table to reload the current page with the records of the temporary table:
pageextension 60008 "Assembly Orders PL" extends "Assembly Orders"//902
{
trigger OnOpenPage()
var
AssemblyOrders: Page "Assembly Orders";
OriginalHeader: Record "Assembly Header";
AssemblyHeaderTemp: Record "Assembly Header" temporary;
begin
if not RunOnce then begin
AssemblyHeaderTemp.Reset();
AssemblyHeaderTemp.DeleteAll();
OriginalHeader.SetRange("Document Type", Rec."Document Type"::Order);
if OriginalHeader.FindSet() then
repeat
// Check if the No. Series have extra security
if LMEnsamblado.ImplicaSeguridad(OriginalHeader."No. Series") then begin
// If the No. Series has extra security, we check if the current user has rights
if LMEnsamblado.TienePermisosLM(OriginalHeader."Item No.") then begin
AssemblyHeaderTemp.Init();
AssemblyHeaderTemp.TransferFields(OriginalHeader);
AssemblyHeaderTemp.CalcFields(Comment);
AssemblyHeaderTemp.CalcFields("Reserved Quantity");
AssemblyHeaderTemp.CalcFields("Reserved Qty. (Base)");
AssemblyHeaderTemp.CalcFields("Assemble to Order");
AssemblyHeaderTemp.CalcFields("Rolled-up Assembly Cost");
AssemblyHeaderTemp.Insert();
end;
end;
until OriginalHeader.Next() = 0;
CurrPage.Close();
AssemblyOrders.SetRecord(AssemblyHeaderTemp);
AssemblyOrders.SetTableView(AssemblyHeaderTemp);
AssemblyOrders.SetRunOnce();
AssemblyOrders.Run();
CurrPage.Update();
end;
end;
procedure SetRunOnce()
begin
RunOnce := true
end;
var
LMEnsamblado: Codeunit "LM Ensamblado";
RunOnce: Boolean;
}
That code it's not making any difference because I'm still getting 91 records, I'm debugging and some entries are not inserted to the table but still exists in the page list...
I've also tried with AssemblyHeaderTemp.Copy(OriginalHeader);
instead of AssemblyHeaderTemp.TransferFields(OriginalHeader);
but I see no difference.
How can I reload the current page with a temporary table view?
Solved by using Mark(true)
and MarkedOnly(true)
:
pageextension 60008 "Assembly Orders PL" extends "Assembly Orders"//902
{
trigger OnOpenPage()
begin
Rec.SetRange("Document Type", Rec."Document Type"::Order);
if Rec.FindSet() then
repeat
if LMEnsamblado.ImplicaSeguridad(Rec."No. Series") then begin
if LMEnsamblado.TienePermisosLM(Rec."Item No.") then begin
Rec.Mark(true);
end;
end else
Rec.Mark(true);
until Rec.Next() = 0;
Rec.MarkedOnly(true);
end;
var
LMEnsamblado: Codeunit "LM Ensamblado";
}
It's the simplest method I've found out :)