multiple groupby

Oct 30, 2013 at 8:57 AM
Edited Oct 30, 2013 at 9:20 AM
Hello. I like your project. It's good! I have some problem of groupby
I have json object
[{"day":30,"week":40,"year":2013,"month":9,
"users":
[{"uid":"eab94452-46ad-4906-8e82-336af58b98e9","FIO":"FIO1","times":21300,"id":9152},      {"uid":"c420058a-9ee3-414c-8aa9-fa001f60455f","FIO":"FIO2","times":16500,"id":9077},{"uid":"dfec73c3-7ad2-4dfa-ab63-a54c673a01dd","FIO":"FIO2","times":2700,"id":8953}]},{"day":1,"week":40,"year":2013,"month":10,"
users":
[{"uid":"9ebf7d10-7cba-4f7d-8cca-53287ab1fa03","FIO":"FIO1","times":33900,"id":9193},{"uid":"1e529eb9-4516-4867-af6b-7c4640ea138d","FIO":"FIO1","times":12600,"id":8615},{"uid":"62230d7b-a0a5-40d4-be47-16a7a6bac200","FIO":"FIO2", "id":8953}]}]
I want to group by month, then inside query users group by FIO.

I create query
Enumerable.From(jobjects).
GroupBy(function (m) { return months[m.month] + ' ' + m.year }, function(val){return { title: months[val.month] + ' ' + val.year, users:val.users }}, 
                   function(key, grouping){ return {title: key, users: grouping.Select("$.users").GroupBy("FIO:$.FIO", null, function(k,g){
return{FIO:k, times:g.Select("$.times").Sum()
}})}}

).ToArray();
But I get error : TypeError: Cannot call method 'GroupBy' of undefined
Please, can you help me.