Using Temp Table for ListPart page source table

samantha73
Member Posts: 118
Hi All
I'm still trying to get tableType = Temporary work in certain scenarios.
Has anyone used a temp table on a listpart page or factbox?
Created a list part page on sales order to show subtotals and the source table is marked as temp table, but then using temp table no data displayed (BC SaaS 19v)
Table
ListPart page - function called from sales order page action
I'm still trying to get tableType = Temporary work in certain scenarios.
Has anyone used a temp table on a listpart page or factbox?
Created a list part page on sales order to show subtotals and the source table is marked as temp table, but then using temp table no data displayed (BC SaaS 19v)
Table
table 60114 SubTotalSales { DataClassification = ToBeClassified; Caption = 'sub'; TableType = Temporary; fields { field(60001; DocNum; Code[50]) { DataClassification = ToBeClassified; Caption = 'Code'; } field(60002; Group1; Integer) { DataClassification = ToBeClassified; Caption = 'Code'; } field(60000; Category; Text[200]) { Caption = 'Category;'; } field(60004; SubTotal; Decimal) { Caption = 'SubTotal'; Editable = false; } } keys { key(PK; DocNum, Group1) { Clustered = true; } }[img]https://us.v-cdn.net/5022383/uploads/editor/c5/k2mhqygzf5cw.png[/img]
ListPart page - function called from sales order page action
page 50105 SalesSubTotalsPart { PageType = ListPart; ApplicationArea = All; Editable = false; UsageCategory = Administration; SourceTable = SubTotalSales; DeleteAllowed = false; InsertAllowed = false; layout { area(content) { repeater(Control2) { Caption = 'Sub'; ShowCaption = false; field(Doc; Rec.DocNum) { ApplicationArea = All; Width = 10; } field(Group1; Rec.Group1) { ApplicationArea = all; } field(Cat; Rec.Category) { ApplicationArea = all; Width = 10; } field(SubTotal; Rec.SubTotal) { ApplicationArea = all; } } } } procedure CalculateSubTotalProc(Var DocNum: Code[50])//called from sales order action var SalesLine: Record "Sales Line"; TotalAmount: Decimal; begin Rec.DeleteAll(); TotalAmount := 0; begin//insert SalesLine.Reset(); SalesLine.SetRange("Document Type", SalesLine."Document Type"::Quote); SalesLine.SetRange("Document No.", DocNum); SalesLine.SetRange(Type, SalesLine.Type::" "); if SalesLine.FindSet() then Rec.Init(); repeat Rec.DocNum := SalesLine."Document No."; Rec.Group1 := SalesLine.Group1; Rec.Category := SalesLine.Description; Rec.Insert(); until SalesLine.Next() = 0; end; begin Rec.Reset(); if Rec.FindSet() then repeat Clear(TotalAmount);// SalesLine.Reset(); SalesLine.SetRange("Document Type", SalesLine."Document Type"::Quote); SalesLine.SetRange("Document No.", Rec.DocNum); SalesLine.SetRange(Group1, Rec.Group1); if SalesLine.FindSet() then repeat TotalAmount := TotalAmount + SalesLine."Line Amount"; until SalesLine.Next() = 0; Rec.SubTotal := TotalAmount; Rec.Modify(); until Rec.Next() = 0; end; end;
0
Answers
-
Hi, I think you can refer to Item Attributes Factbox (9110, ListPart).
0 -
Checked the item attributes but the table construct is different as the source table itself is not a temp table. Temporary property is only defined on the page
page 9110 "Item Attributes Factbox" { Caption = 'Item Attributes'; DeleteAllowed = false; InsertAllowed = false; ModifyAllowed = false; PageType = ListPart; RefreshOnActivate = true; SourceTable = "Item Attribute Value"; SourceTableTemporary = true; layout {
0 -
First of all generate data on subpage. On Sales Order Header Card/List add code OnAfterGetRecord. This code should call function from your subpage. Of course use variable that suits you best.:
CurrPage.PagePart.Page.SetTempSourceData(Rec);
Here in subpage assign what you wish to preview. For exampleprocedure SetTempSourceData(SalesHeader: Record "Sales Header") var SalesLine: Record "Sales Line"; begin SalesLine.SetRange("Document Type", SalesHeader."Document Type"); SalesLine.SetRange("Document No.", SalesHeader."No."); if SalesLine.FindSet() then begin repeat Rec := SalesLine; Rec.Insert(); until SalesLine.Next() = 0; end; CurrPage.Update(); end;
0
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