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.
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.
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.
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,
[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 ?
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.
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.
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.
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 )
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.
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156