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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to display the sum of all marked records on a grid

(0) ShareShare
ReportReport
Posted on by 241

Hi all

I have a form with a grid on it.  One of the fields is an amount.  The requirement is to display the sum of all marked records above the grid.

My client has a list of 100s of records and wants to see the total of the records they have selected to process.

example

Sum Amount to display a top of grid = (Selected amount  = $500)

Mark Code Description Amount
A A description $50.00
B A description $150.00
x C A description $400.00
x D A description $100.00

Is there a way to do this in Dynamics 365 Finance and operations

I have the same question (0)
  • Suggested answer
    Christoph Thaler Profile Picture
    5,442 on at

    Hi Sophia.r,

    I‘m not a developer but just want to inform / warn you because some new features will come during the next months. I‘m talking about the new grid control with grouping and total capabilities. You can find some more details here docs.microsoft.com/.../grid-capabilities. Maybe your requirement is solved here?

    If you modify the current / old grid you have to think about how to be able to transfer you modification to the new grid.

  • Suggested answer
    Dynamics Community 101 Profile Picture
    310 on at

    Hi Sophia.r,

    You can write the code in markChanged() method.It is called whenever you select a record.

  • Suggested answer
    Rahul Mohta Profile Picture
    21,046 on at

    without code, could Use PU35 preview feature - to Group and sum on numeric fields

    User can filter records and then use sum on column

  • Sophia.r Profile Picture
    241 on at

    Hi Atul

    I think this is where I will need to add the code.  But what do I test.  This method is fired each time the record is marked or unmarked.  But how do I test if it is marked.(Therefore adding the amount)

     or if the record is unmarked(removing the amount).  Is there someway that I can do a select sum(AmountCur) from TableA_ds where marked.  

    Above in bold is in short what I need to do, how would I do it on a form.

  • Martin Dráb Profile Picture
    239,680 Most Valuable Professional on at

    SQL queries can be used to query data in a SQL database (or a temporary table). You can't query the state of a form with SQL.

    You can use MultiSelectionHelper class to iterate selected records and sum amounts by yourself.

  • Dynamics Community 101 Profile Picture
    310 on at

    Hi Sophia.r,

    You can make a new NoYes EDT type field in the table and assign/unassign the value whenever "markChanged" is hit

    and add/remove the amount accordingly

  • Sophia.r Profile Picture
    241 on at

    /// 
            /// Update the total showing the sum of selected records
            /// 
            public void markChanged()
            {
                MultiSelectionHelper            helper = MultiSelectionHelper::construct();
                transTable           markTrans;
                super();
                helper.parmDatasource(transTable_ds);
    
                totalTransMarked = 0;
                markTrans = helper.getFirst();
    
                while(markTrans)
                {
                    totalTransMarked = totalTransMarked   markTrans.AmountTrans;
                    markTrans = helper.getNext();
                }
                TransTotalSelected.realValue(totalTransMarked);
                
            }

    Hi All

    Thank you for all the responses.  So I was able to solve this using the markChanged() method and the multiselectionHelper.  See code above

  • ShamikaK Profile Picture
    10 on at

    So, you want to display sum of 'Amount' column for selected records only?  

    Microsoft has introduced a new grid control in 10.0.10 version and later. By enabling this feature, user will be able to group data based on values from one or more columns and can see totals for numeric columns in tabular grids.

  • Suggested answer
    saurabh bharti Profile Picture
    15,059 Moderator on at

    Hi Sophia,

    This is available in out of the box feature of Dynamics .

    This is available with platform update 35. and enable following in feature management.

    fm.JPG

    Here is one blog for the same:

    https://exploredynamics365.home.blog/2020/07/11/grid-control-personalization-feature-utilization-in-microsoft-dynamics-365-finance-and-operations/

  • Martin Dráb Profile Picture
    239,680 Most Valuable Professional on at

    Yes, it was suggested in the very first reply. I guess she doesn't want or can't use it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 658 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 632 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 570

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans