Posts

Showing posts from April, 2023

Year wise data for faster execution, in D365FO, using Views

Image
  You must have bumped across a situation in your implementation career, where you needed to class your data, based on year. As an example: It becomes very difficult to design such a structure, where individually you might need to write code for every customer, for each year: select sum(AmountMST) from custTable where custTable.TransDate >= fromDate && custTable.TransDate <= toDate; It will eventually result in extreme slowness of the process, which will make it go through each and every customer, over and over for all customers, for all the years. Definitely not a good solution. In all such cases, we can make a solution like this: a. Pre-calculating the year as 'Year-names' in a view, where we can store the years like 2021, 2022, 2023, (no hardcoding): Here 'YearName' is a computed column, which looks like this: private static server str compYearName()     {                  #define.PPCustTransYearNameView(PPCustTransYearNameView)         #define.Data