Skip to main content

Posts

Showing posts from December, 2015

Complex grouping of records for processing [AX 2012]

In this post I will discuss complex grouping of records for processing in a batch.There are many ways to achieve this but most of the time I see developers using temp tables. I feel that is not necessarily the most best way. So, in this post I will show how you can do the same using a map and a RecordSortedList. Avoiding multiple loops through records and also avoiding temp tables. Scenario Assume a scenario where you have to loop through unsorted records. Group them by the multiple fields including things like financial dimension value and balance. Then create a journal for each group. Options This could be achieved in a number of ways. But we want the best performing and extendable solution. You could do a group by selection query but that won’t work as you have to get the balance and dimensions (which are calculations). You could use a temp table to insert all the transaction. What if the key changes a few months later. Could be costly to develop the changes. You could use