mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 06:36:55 +01:00
* Add BC performance knowledge from OptimAL learnings Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Address review feedback on performance guidance Clarify predicate-supporting keys versus covering queries, demonstrate proven cache reuse, and evaluate the updated partial-load and bulk-update rules. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
43 lines
1.5 KiB
AL
43 lines
1.5 KiB
AL
// The only supported read filters customer/date and displays item, quantity, and amount.
|
|
// No consumer needs ordering on the displayed fields or a SIFT aggregate.
|
|
table 50362 "Perf Document Entry"
|
|
{
|
|
DataClassification = CustomerContent;
|
|
|
|
fields
|
|
{
|
|
field(1; "Entry No."; Integer) { }
|
|
field(2; "Customer No."; Code[20]) { }
|
|
field(3; "Posting Date"; Date) { }
|
|
field(4; "Item No."; Code[20]) { }
|
|
field(5; Quantity; Decimal) { }
|
|
field(6; Amount; Decimal) { }
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "Entry No.") { Clustered = true; }
|
|
key(CustomerDate; "Customer No.", "Posting Date") { }
|
|
key(CustomerDateItem; "Customer No.", "Posting Date", "Item No.") { }
|
|
key(CustomerDateQuantity; "Customer No.", "Posting Date", Quantity) { }
|
|
key(CustomerDateAmount; "Customer No.", "Posting Date", Amount) { }
|
|
}
|
|
}
|
|
|
|
codeunit 50375 "Perf Document Reader Bad"
|
|
{
|
|
procedure CustomerDateTotals(CustomerNo: Code[20]; FromDate: Date; ToDate: Date; var ItemNos: List of [Code[20]]; var TotalAmount: Decimal; var TotalQuantity: Decimal)
|
|
var
|
|
Entry: Record "Perf Document Entry";
|
|
begin
|
|
Entry.SetRange("Customer No.", CustomerNo);
|
|
Entry.SetRange("Posting Date", FromDate, ToDate);
|
|
Entry.SetLoadFields("Item No.", Quantity, Amount);
|
|
if Entry.FindSet() then
|
|
repeat
|
|
ItemNos.Add(Entry."Item No.");
|
|
TotalQuantity += Entry.Quantity;
|
|
TotalAmount += Entry.Amount;
|
|
until Entry.Next() = 0;
|
|
end;
|
|
}
|