Search code examples
c#.nettemplatesgroupingstringtemplate

Grouping in StringTemplate


I've just begun using StringTemplate (from stringTemplate.org) and I'd like to know how to achieve grouping in the results.

e.g.

Month , ID
__________________________________
Jan ,1
Jan ,2
Feb ,3
Feb ,4
Feb ,5
Mar ,6
Mar ,7
Mar ,8
Mar ,9

so that the results when grouped by month look something like:

Jan:
1
2
Feb:
3
4
5
Mar:
6
7
8
9


Solution

  • it all depends on how you send in the data. ST won't do any computation for you, which normally includes what belongs in what set.