Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Need to add Grouping for warehouse and netamount in Retail sales page

(0) ShareShare
ReportReport
Posted on by 148

Hello everyone,

Below image is refers to Retail sales page.

based on our inputs it shows data.

as per image, line num 1 and 3 have same warehouse and netamount, in this case can we display in single line with using grouping of warehouse and netamount.

is above requirement is possible ??

Thanks in advance.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    You can add Group by fields on Category, transdate, transtime. In your screenshot, since category field value is same, you will see that value but transdate and transtime will be blank.

    If you go by Group By Field from User Interface then create a Saved View and publish it to everyone.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    This will be the issue when you add group by via code in the form. It's better to go with form personalization instead of customization.

    Thanks,

    Girish S.

  • Suggested answer
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    Adding to Grish's reply.

    New grid control is the feature that is now enabled by default in new versions of D365 FO environments.

    If it is not enabled, you can search for it is the Feature management workspace and enable it.

    You can apply grouping by simply right-clicking on the grid's column and selecting group by column

    You can select and include multiple columns in the group to view the results.

    If your requirements are getting fulfilled using the grid feature then I would suggest to implement it rather than opting for customization.

    Thanks,

  • Prasanth Profile Picture
    Prasanth 148 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    [FormDataSourceEventHandler(formDataSourceStr(RetailSales, RetailTransactionSalesTrans), FormDataSourceEventType::QueryExecuting)]
        public static void RetailTransactionSalesTrans_OnQueryExecuting(FormDataSource sender, FormDataSourceEventArgs e)
        {
            FormRun             formRun      = sender.formRun() as FormRun;
            var                 args         = e as FormDataSourceCancelEventArgs;
            FormDataSource      RetailSales_ds = formRun.dataSource(formDataSourceStr(RetailSales, RetailTransactionSalesTrans)) as FormDataSource;
            RetailTransactionSalesTrans RetailTransactionSalesTrans    = RetailSales_ds.cursor();
    
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addGroupByField(fieldNum(RetailTransactionSalesTrans, CategoryId));
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addGroupByField(fieldNum(RetailTransactionSalesTrans, ItemId));
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addGroupByField(fieldNum(RetailTransactionSalesTrans, InventLocationId));
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addGroupByField(fieldNum(RetailTransactionSalesTrans, netAmount));
            RetailSales_ds.query().dataSourceName('InventDim').addGroupByField(fieldNum(InventDim, InventLocationId));
            RetailSales_ds.query().dataSourceName('InventDim').addGroupByField(fieldNum(InventDim, InventSiteId));
    
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addSelectionField(fieldNum(RetailTransactionSalesTrans,netAmount),SelectionField::Sum);
            RetailSales_ds.query().dataSourceName('RetailTransactionSalesTrans').addSelectionField(fieldNum(RetailTransactionSalesTrans,qty),SelectionField::Sum);
        }

    I wrote like above , grouping is working fine but few fields data is not showing in form, like Category, transdate, transtime.

    is there any chance to display those values also ?

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    Also, you can do that via personalization. Refer to the below link.

    https://www.linkedin.com/pulse/grid-capabilities-d365fo-mohamed-zakarya?trk=pulse-article

    Thanks,

    Girish S.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    You can achieve that by writing code before next in execute query of that ds in form. But I think that will cause an issue in showing the data as if the field is not grouped, then that will be empty.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    Check whether the below thread helps you with grouping on the form. I have never added group by on form, but you can give it a try and let us know the output.

    https://www.dynamicsuser.net/t/grouping-records-in-a-form/31755/6

    Thanks,

    Girish S.

  • Prasanth Profile Picture
    Prasanth 148 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    Thank you for responding Girish,

    Size should be blank. if we have multiple lines with same warehouse and netamount we need to show in single line (  qty and net amount will be sum )

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Need to add Grouping for warehouse and netamount in Retail sales page

    Hi Prashanth,

    But for Line number 1 Size value is 2-3 and for Line number 3 Size value is 5-6.

    So, if you add group by via code how will you handle this? I mean which size you will display on the line if you consolidate.

    Thanks,

    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans