We have a complex report in which we want to add groups. We are experiencing issues displaying data when the GroupBy instruction is added: the report completely breaks, every tag gets a blank value and the result is an empty report, only the group headers (<<[Key]>>) are shown. We don’t understand what is wrong with the template or how should we approach this issue. We have read the LINQ documentation but we haven’t found related examples. I attach a zip file which contains the template with both the working (no groups) code and the non-working (groups) code.GroupBy Example.zip (18.8 KB)
GroupBy returns an enumeration of groups, each of which contains an enumeration of source items. Please see a
GroupBy example at Appendix A. Enumeration Extension Methods for more information.
That is, in your case, you need to use two nested
foreach tags - an outer one to enumerate groups returned by
GroupBy and an inner one to enumerate items of each group. I have modified your template to show this. Please check Template Modified.docx (16.4 KB).