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

Community site session details

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

How to remove Repeated values

(0) ShareShare
ReportReport
Posted on by 105

Hello All,

I have developed a report from VS code and designed a simple RDLC layout to print output, but when I run my report the first row is correct according to the formula but the following rows are repeating/duplicating with the same values while values are expected to vary according to the transaction, can someone please guide me on how to prevent duplicates.

below is my code and report output 

report 50100 CustLedgerEntry
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = all;
    Caption = 'Customer vs Balance';
    DefaultLayout = RDLC;
    RDLCLayout = 'CustomerBalance.rdl';

    dataset
    {

        dataitem("Cust. Ledger Entry"; "Cust. Ledger Entry")
        {
            RequestFilterFields = "Customer No.", "Posting Date";
            column(Posting_Date; "Posting Date"{ }
            column(Document_Type; "Document Type"{ }
            column(Document_No_; "Document No."{ }
            column(Description; Description{ }
            dataitem(Customer; Customer)
            {
                DataItemLink = "No." = field("Customer No.");
                column(No_; "No."{ }
                column(Balance__LCY_; "Balance (LCY)"{ }
                column(Debit_Amount__LCY_; "Debit Amount (LCY)"{ }
                column(Credit_Amount__LCY_; "Credit Amount (LCY)"{ }
                column(BalanceTotal; BalanceTotal{ }


                trigger OnAfterGetRecord()
                begin

                    BalanceTotal := "Balance (LCY)" + ("Debit Amount (LCY)" - "Credit Amount (LCY)");
                end;

            }


        }
    }


    var
        Cust: Record Customer;
        BalanceTotal: Decimal;
}
pastedimage1651904176919v1.png
Thank you for your support

 

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    Hi, 

    I would like to request you please move your second data item first and then call your customer ledger entries data item link with first data item.

    then please check how it prints the values

  • Maro9595 Profile Picture
    105 on at
    RE: How to remove Repeated values

    Thank you Nitin for your reply, I have changed it as you said but the results are the same see the code

    dataitem(Customer; Customer)

           {

               RequestFilterFields = "No.";

               column(No_; "No.") { }

               column(Balance__LCY_; "Balance (LCY)") { }

               column(Debit_Amount__LCY_; "Debit Amount (LCY)") { }

               column(Credit_Amount__LCY_; "Credit Amount (LCY)") { }

               column(BalanceTotal; BalanceTotal) { }

               dataitem("Cust. Ledger Entry"; "Cust. Ledger Entry")

               {

                   RequestFilterFields = "Posting Date";

                   DataItemLink = "Customer No." = field("No.");

                   column(Posting_Date; "Posting Date") { }

                   column(Document_Type; "Document Type") { }

                   column(Document_No_; "Document No.") { }

                   column(Description; Description) { }

               }

               trigger OnAfterGetRecord()

               begin

                   BalanceTotal := "Balance (LCY)" + ("Debit Amount (LCY)" - "Credit Amount (LCY)");

               end;

           }

  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    Hi,

    Have you changed the RDLC table and put it again,

    I mean please remove the table from RDLC layout and put it again with all fields from customer ledger entries.

    Otherwise you have to make grouping by customer no., document no. In RDLC layout

    Then please try again

  • Maro9595 Profile Picture
    105 on at
    RE: How to remove Repeated values

    Hi, Nitin once more,

    I have deleted the layout completely and designed it again still the duplicates are there, then I tried to group by the customer no. (this shows only one record only first row but the rest are not showing)

  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    Hi,

    Can you please replace your report coding with below?

    report 50100 CustLedgerEntry

    {

       UsageCategory = ReportsAndAnalysis;

       ApplicationArea = all;

       Caption = 'Customer vs Balance';

       DefaultLayout = RDLC;

       RDLCLayout = 'CustomerBalance.rdl';

       dataset

       {

           dataitem(Customer; Customer)

           {

               column(No_; "No.") { }

               column(Balance__LCY_; "Balance (LCY)") { }

               column(Debit_Amount__LCY_; "Debit Amount (LCY)") { }

               column(Credit_Amount__LCY_; "Credit Amount (LCY)") { }

               column(BalanceTotal; BalanceTotal)

               { }

               dataitem("Cust. Ledger Entry"; "Cust. Ledger Entry")

               {

                   DataItemLinkReference = customer;

                   DataItemLink = "Customer No." = field("No.");

                   RequestFilterFields = "Customer No.", "Posting Date";

                   column(Posting_Date; "Posting Date") { }

                   column(Document_Type; "Document Type") { }

                   column(Document_No_; "Document No.") { }

                   column(Description; Description) { }

               }

               trigger OnAfterGetRecord()

               begin

                   BalanceTotal := "Balance (LCY)" + ("Debit Amount (LCY)" - "Credit Amount (LCY)");

               end;

           }

       }

       var

           Cust: Record Customer;

           BalanceTotal: Decimal;

    }

  • Maro9595 Profile Picture
    105 on at
    RE: How to remove Repeated values

    I have done so, but it pulling out all customers despite applying filters on the request page while I need the information of only one customer

  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    Also please check your have to put the grouping on Document No. not customer No., and delete the Details Row from Table from report design layout.

    Add all the fields into Group row not in details row.

    See the image.[View:/cfs-file/__key/communityserver-discussions-components-files/758/CustomerBalance.rdlc:320:240]

    pastedimage1651927587837v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    [View:/cfs-file/__key/communityserver-discussions-components-files/758/7144.CustomerBalance.rdlc:320:240]Hi,

    Please find the attach RDLC layout after putting customer No. grouping.

    pastedimage1651927994026v2.png

    Thanks.

  • Maro9595 Profile Picture
    105 on at
    RE: How to remove Repeated values

    Thank you Nitin,

    for these three fields it works but including all fields and the formula of balance total column duplications starts

  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: How to remove Repeated values

    Please check my last message with report layout and image it’s working fine for me.

    Now you have to check why your custom fields is repeating the values you have to clear them in some other trigger

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

Quick Links

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,401

#2
Sumit Singh Profile Picture

Sumit Singh 2,692

#3
YUN ZHU Profile Picture

YUN ZHU 1,935 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans