I'm trying to solve the following problem, I have a Collection that contain some data:
+-------------+---------------+-------------+
| Date | InitialValue | FinalValue |
+-------------+---------------+-------------+
| 21.05.2003 | 0 | 382087.14 |
| 23.06.2003 | 408206.52 | 110622.79 |
| 19.07.2004 | 123811.34 | 0 |
| 31.12.2011 | 0 | 0 |
| 08.06.2012 | 0 | 501854.71 |
| 31.12.2012 | 501854.71 | 546208.19 |
| 31.12.2013 | 634535.58 | 666284.47 |
| 30.06.2014 | 666284.47 | 725837.32 |
| 08.07.2014 | 725837.32 | 729646.48 |
+-------------+---------------+-------------+
What I need to do is to split this list into multiple lists when the final value is equal to 0. The expected result should be something like this:
Result list 1
+-------------+---------------+-------------+
| Date | InitialValue | FinalValue |
+-------------+---------------+-------------+
| 21.05.2003 | 0 | 382087.14 |
| 23.06.2003 | 408206.52 | 110622.79 |
| 19.07.2004 | 123811.34 | 0 |
+-------------+---------------+-------------+
Result list 2
+-------------+---------------+-------------+
| Date | InitialValue | FinalValue |
+-------------+---------------+-------------+
| 31.12.2011 | 0 | 0 |
+-------------+---------------+-------------+
Result list 3
+-------------+---------------+-------------+
| Date | InitialValue | FinalValue |
+-------------+---------------+-------------+
| 08.06.2012 | 0 | 501854.71 |
| 31.12.2012 | 501854.71 | 546208.19 |
| 31.12.2013 | 634535.58 | 666284.47 |
| 30.06.2014 | 666284.47 | 725837.32 |
| 08.07.2014 | 725837.32 | 729646.48 |
+-------------+---------------+-------------+
Can somebody give me an elegant way to solve my problem?
>`) outside the loop (which is exactly what your answer does).
– Zack Butcher Jul 09 '14 at 13:52