1

So far I have grouped an IQueryable of results into distinct groups based on 1 double property, the double being a theoretical total, for example:

 IGrouping<double?, IEnumerable<typeof>>()

 1.2, 1.5, 2.1, 3.6, 3.7, 3.8, 4.0, 4.5, 5.6, 5.7   etc.

Each double value has a list of objects associated with it.

Is it possible to then group the result set into groups based on an interval / range. For example, if 1.2 is the min value, group per every 1.0 and concatenate the List<> data within the interval / range. Doing this before the query is executed and out of the db and into memory.

So, the first result set from 1.2 becomes:

{1.2, 1.5, 2.1} 

and joins the Lists into a single grouping, the theoretical cutoff point being

(1.2 + 1) = 2.2.

The intervals, or slices continue:

1.2 - 2.2 = 3 sets into 1 group
2.2 - 3.2 = 0   ''
3.2 - 4.2 = 4   ''

Not sure how to space the intervals so that they don't incorporate each other

1.2 -> 2.2 - 2.2 -> 3.2 

If a record has a value of 2.2 both set of results on either side will incorporate the same record.

Furthermore, is it possible to create a virtual starting point for the grouping, say 1.0? So the result set becomes

{1.2, 1.5} 

cutoff point being 2.0?

Thanks

d_unique
  • 21
  • 1
  • 3

0 Answers0