Announcements
Hi mates! :)
I need your help, I created a button on Sales Order List that count all the records (it's ok) and now, I need another one that sum all the amounts of the filtered records.
Something like:
Order 1 -> 20
Order 2 -> 40
Order 4 -> 10
Pressing button (action) and --> Total Amount: 70
Is there any way to do that?
Thanks a lot :)
Thanks Lars!
That worked :D
Hello, just an example below. It is wrong at least on one point that it is totalling Amount, not Amount (LCY), so it will total $, £, etc alike. But I hope it gives you some ideas where to start:
pageextension 50101 OrderTotals extends "Sales Order List"
{
layout
{
// Add changes to page layout here
}
actions
{
addfirst("F&unctions")
{
action(GetTotal)
{
ApplicationArea = all;
Caption = 'Get Total';
trigger OnAction()
var
SalesHeader: Record "Sales Header";
Total: Decimal;
begin
Total := 0;
SalesHeader.copy(Rec);
if SalesHeader.FindSet() then
repeat
total := total + SalesHeader.Amount;
until SalesHeader.Next() = 0;
Message(Format(Total));
end;
}
}
// Add changes to page actions here
}
var
myInt: Integer;
}
You can start from here
Hi Mohana :)
How can I do that?
Thanks! :)
You can loop through all orders and assign the Amount a Sum variable and display the message at the end.
André Arnaud de Cal...
294,095
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator