web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Business central table 1150 "Report Totals Buffer" Add logic

(0) ShareShare
ReportReport
Posted on by 35

Here, Amount and NewAmount will actually be different values.

Amount has not been specified at all, so it will be 0 or the NewAmount of the previous data.

Is there a logic error?

pastedimage1620877582338v1.png

I have the same question (0)
  • Verified answer
    keangwang Profile Picture
    35 on at

    12.1.24822.25467 has been fix this problem
    pastedimage1621392225028v1.png

  • keangwang Profile Picture
    35 on at

    ya,i saw the same code a few day ago

    but last day,i got version 18.1.24822.25158

    the code had become

    table 1150 "Report Totals Buffer"
    {
        Caption = 'Report Totals Buffer';
        ReplicateData = false;
    
        fields
        {
            field(1; "Line No."; Integer)
            {
                Caption = 'Line No.';
                DataClassification = SystemMetadata;
            }
            field(2; Description; Text[250])
            {
                Caption = 'Description';
                DataClassification = SystemMetadata;
            }
            field(3; Amount; Decimal)
            {
                Caption = 'Amount';
                DataClassification = SystemMetadata;
            }
            field(4; "Amount Formatted"; Text[30])
            {
                Caption = 'Amount Formatted';
                DataClassification = SystemMetadata;
            }
            field(5; "Font Bold"; Boolean)
            {
                Caption = 'Font Bold';
                DataClassification = SystemMetadata;
            }
            field(6; "Font Underline"; Boolean)
            {
                Caption = 'Font Underline';
                DataClassification = SystemMetadata;
            }
            field(7; "Font Italics"; Boolean)
            {
                Caption = 'Font Italics';
                DataClassification = SystemMetadata;
            }
        }
    
        keys
        {
            key(Key1; "Line No.")
            {
                Clustered = true;
            }
        }
    
        fieldgroups
        {
        }
    
        procedure Add(NewDescription: Text[250]; NewAmount: Decimal; NewBold: Boolean; NewUnderline: Boolean; NewItalics: Boolean)
        begin
            AddTotal(NewDescription, NewAmount, NewBold, NewUnderline, NewItalics, Format(Amount, 0, ''));
        end;
    
        procedure Add(NewDescription: Text[250]; NewAmount: Decimal; NewBold: Boolean; NewUnderline: Boolean; NewItalics: Boolean; AutoFormatExp: Text[80])
        var
            AutoFormat: Codeunit "Auto Format";
        begin
            AddTotal(NewDescription, NewAmount, NewBold, NewUnderline, NewItalics, Format(Amount, 0, AutoFormat.ResolveAutoFormat("Auto Format"::AmountFormat, AutoFormatExp)));
        end;
    
        local procedure AddTotal(NewDescription: Text[250]; NewAmount: Decimal; NewBold: Boolean; NewUnderline: Boolean; NewItalics: Boolean; AmountFormatted: Text[30])
        begin
            if FindLast() then;
            Init();
            "Line No."  = 1;
            Description := NewDescription;
            Amount := NewAmount;
            "Amount Formatted" := AmountFormatted;
            "Font Bold" := NewBold;
            "Font Underline" := NewUnderline;
            "Font Italics" := NewItalics;
            Insert(true);
        end;
    }
    
    

  • DynaExperts Profile Picture
    573 on at

    Hello keangwang,

    I don't see an error here unless you have some specific scenario.

    Here in the code,

    1. Amount is the field of the table

    2. NewAmount is passed as parameter in Procedure "Add"

    3. After the procedure call, Amount will be assigned with whatever value is passed in the procedure.

    4. Same way, "Amount formatted" is assigned with the parameter "AmountFormatted" value.

    In BC 18, this code is slightly changed and current code looks as below: [Amount Formatted now gets formatted directly in the preocedure and not assigned a parameter value

    table 1150 "Report Totals Buffer"
    {
        Caption = 'Report Totals Buffer';
        ReplicateData = false;
    
        fields
        {
            field(1; "Line No."; Integer)
            {
                Caption = 'Line No.';
                DataClassification = SystemMetadata;
            }
            field(2; Description; Text[250])
            {
                Caption = 'Description';
                DataClassification = SystemMetadata;
            }
            field(3; Amount; Decimal)
            {
                Caption = 'Amount';
                DataClassification = SystemMetadata;
            }
            field(4; "Amount Formatted"; Text[30])
            {
                Caption = 'Amount Formatted';
                DataClassification = SystemMetadata;
            }
            field(5; "Font Bold"; Boolean)
            {
                Caption = 'Font Bold';
                DataClassification = SystemMetadata;
            }
            field(6; "Font Underline"; Boolean)
            {
                Caption = 'Font Underline';
                DataClassification = SystemMetadata;
            }
            field(7; "Font Italics"; Boolean)
            {
                Caption = 'Font Italics';
                DataClassification = SystemMetadata;
            }
        }
    
        keys
        {
            key(Key1; "Line No.")
            {
                Clustered = true;
            }
        }
    
        fieldgroups
        {
        }
    
        procedure Add(NewDescription: Text[250]; NewAmount: Decimal; NewBold: Boolean; NewUnderline: Boolean; NewItalics: Boolean)
        begin
            if FindLast then;
            Init;
            "Line No."  = 1;
            Description := NewDescription;
            Amount := NewAmount;
            "Amount Formatted" := Format(Amount, 0, '');
            "Font Bold" := NewBold;
            "Font Underline" := NewUnderline;
            "Font Italics" := NewItalics;
            Insert(true);
        end;
    }
    
    

    Hope above explanation helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,476

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 789 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 719 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans