How can I reload current page with a temporary table records?

kuhi
Member Posts: 18
I'm in page "Assembly Orders" 902 trying to filter out some records and display only the assembly orders that the user is allowed.
Basically, trying to populate a temporary table to reload the current page with the records of the temporary table:
The standard page without customization returns 91 assembly orders. This customization also returns 91 assembly orders. So the view is not applied because debugging I can see that it's inserting the correct records to the temporary table.
How can I reload the current page with a temporary table view?
Thanks in advance
Basically, 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; }
The standard page without customization returns 91 assembly orders. This customization also returns 91 assembly orders. So the view is not applied because debugging I can see that it's inserting the correct records to the temporary table.
How can I reload the current page with a temporary table view?
Thanks in advance

0
Answers
-
Called like you do, the page uses the database table, not your temporary one. SetRecord sets the position, SetTableView transfers the view (Filters and sorting) but these are applied to to the pages Rec.
You would need to call the page usingPage.Run(PAGE::"Assembly Orders",AssemblyHeaderTemp)
in order to run it on the temporary table. You can then replaceif not RunOnce then
byif not IsTemporary then
Another, and in my opinion better approach was to filter the page, rather that to populate a temporary one.
You could use an approach similar to the one Page 31 Item List uses for Item Attribute filtering, or even drop the temp table and filter on the fly. In essence you need to implement OnFindRecord and OnNextRecord for the page in such a way that it only finds or steps to records you want to show.
Have a look at Filtering data on form using OnFindRecord and OnNextRecord to see how this can be done. Your condition on when to insert a record into the temp table above would go to the function ShowThisRecord there.1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions