id’like to count how many documents a User edited or created. Therefore I have a Datatable which contains the information sth. like this:
Input
DocumentName | ModifiedBy | CreatedBy
a Frank Frank
b Mike Frank
c John Mike
That should be the Output:
Name DocumentsModified(Total) DocumentsCreated(Total)
Frank 1 2
Mike 1 1
John 1 0
So what it did to count all documents a person edited, is the following
var query = from queryResult in resultTable.AsEnumerable()
group queryResult by queryResult.Field<string>("ModifiedBy") into rowGroup
select new
{
Name = rowGroup.Key, ModifiedDocuments = rowGroup.Count()
};
This works fine. Now i have to count also the values of the column “Creator”. Is this possible and if so, how would i do that? OK, i could iterate over the table, but it would be nice to accomplish this in the LinQ query.
I tried to use “group queryResult by new {}” but i’m not sure if i’m on the right track.
You’re best bet would be to just query for created and modified separately and then combine the results with a join.