linq - How to perform Sum of a column dynamically in C#? -


i using system.linq.dynamic group columns using linq dynamically , need perform

how can sum column i.e.(sum(deposits)). user select table , columns @ runtime. enter image description here ex: above table has territory, state, bankname, year, quarterfrommaint

assume user has selected these columns grouping (territory, state, bankname) , wants sum column ex:deposits. how can this? because asenumerable , asqueryable has sum. need perform groupby , sum

click here further clarification , code is:

enter image description here

here t1 table , qfields list contains grouping columns.

how can use linq sum column after groupby?

do mean this? if not, please disregard...

var query = rows     .groupby(row => new { row.territory, row.state, row.bankname })     .select(group => new     {         group.key.territory, group.key.state, group.key.bankname,         deposits = group.sum(row => row.deposits)     }); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -