Avatar of hotshottools
hotshottools

asked on 

DataTable calculated field question

I have a datatable that has a grouping in it and I want to be able to assign a value to a calculated field based on the first (or matching) fields in the group.

For example, if I have the following table:

MyGroup       MyDateVar
gr-1                2001-12-23
gr-1                2004-03-12
gr-1                2014-10-04
gr-1                2003-12-23
gr-1                2012-03-12
gr-1                2000-10-04

I would like to have a calculated column that would have a value (say 10) for the oldest MyDateVar for the group.  The final result would be:


MyGroup       MyDateVar      CalcField
gr-1                2001-12-23      0
gr-1                2004-03-12      0
gr-1                2014-10-04      10
gr-1                2003-12-23      0
gr-1                2012-03-12      10
gr-1                2000-10-04      0

Can this be done with a datacolumn calculated field?
.NET ProgrammingMicrosoft Development

Avatar of undefined
Last Comment
louisfr

8/22/2022 - Mon