# Filter row by following order with loop

**URL:** <https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791>\
**Category:** KNIME Analytics Platform\
**Created:** [October 27, 2023, 9:59pm UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791 "2023-10-27T21:59:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stef\_pf](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/cc9497/32.png) [@stef\_pf](https://forum.knime.com/u/stef_pf)\
**Post date:** [October 27, 2023, 9:59pm UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/1 "2023-10-27T21:59:47Z")

</div>

Hi all,

I need your help, maybe it’s easy, I’m beginner and I’m still learning. I want to resolve this problem by using a loop.

Below my data:

| Specific Problem | Sites | Cease\_Date | Event\_Date | GroupID2 |
| --- | --- | --- | --- | --- |
| Loss of Mains | 125 | 2023-08-30 11:38:08 | 2023-08-30 00:42:24 | 0 |
| Battery Discharging | 125 | 2023-08-30 11:38:08 | 2023-08-30 00:43:22 | 1 |
| Battery Disconnect | 125 | 2023-08-30 11:38:08 | 2023-08-30 01:14:41 | 2 |
| Loss of Mains | 125 | 2023-08-31 09:59:52 | 2023-08-30 13:11:27 | 0 |
| Battery Discharging | 125 | 2023-08-31 09:45:47 | 2023-08-30 13:12:24 | 1 |
| Battery Disconnect | 125 | 2023-08-31 09:45:47 | 2023-08-30 13:33:36 | 2 |
| Battery Discharging | 125 | 2023-08-31 09:59:52 | 2023-08-31 09:44:06 | 1 |
| Battery Disconnect | 125 | 2023-08-31 09:59:52 | 2023-08-31 09:48:22 | 2 |
| Loss of Mains | 125 | 2023-09-19 13:42:12 | 2023-09-19 13:41:59 | 0 |

The order must be 0,1,2, if it doesn’t follow, I don’t want it. I have group by three rows, with a chunk loop start. But after I don’t know how to proceed.

I have already group by a group loop by sites.

Any suggestion?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![marzukim](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@marzukim](https://forum.knime.com/u/marzukim)\
**Post date:** [October 28, 2023, 6:11am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/2 "2023-10-28T06:11:59Z")

</div>

hi @stef_pf  
not sure if this meets your expectations, but i’ve filtered out the ‘chunk group’ that doesn’t follow the sequence, based on your requirements.  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/d/7/d732391154cf3cf1ef456c5ab8ea303584fbf7f2.png)  
[KNIME\_order-MM.knwf](https://forum.knime.com/uploads/short-url/gAnXgOxRYJrpLs7wCW0gmOGX1wl.knwf) (123.9 KB)  
_rgds_  
_linux knime 5.1.x_

---

<div class="post-metadata">

**Author:** ![HansS](https://forum-cdn.knime.com/user_avatar/forum.knime.com/hanss/32/6979_2.png) [@HansS](https://forum.knime.com/u/HansS)\
**Post date:** [October 28, 2023, 7:04am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/3 "2023-10-28T07:04:35Z")

</div>

Hi @stef_pf

Another approach without using a loop [filter\_chunks\_of\_rows\_by\_row\_order.knwf](https://forum.knime.com/uploads/short-url/hIxsnDC6uOQVWXJheXU7kJeelwM.knwf) (26.3 KB)

 ![Schermafdruk van 2023-10-28 09-02-59](https://forum-cdn.knime.com/uploads/default/original/3X/c/1/c1dd75027ff7f68f5ec14752cbe2cd5df1cca6ae.png)  
gr. Hans

---

<div class="post-metadata">

**Author:** ![marzukim](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@marzukim](https://forum.knime.com/u/marzukim)\
**Post date:** [October 28, 2023, 7:35am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/4 "2023-10-28T07:35:30Z")

</div>

@HansS , your workflow approach is outstanding … simplified, optimized, and more efficient to execute. @stef_pf , i highly recommend trying Hans’s approach to achieve a fast and optimized workflow. in my opinion, it is the best **solution** for your challenges.

rgds

---

<div class="post-metadata">

**Author:** ![stef\_pf](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/cc9497/32.png) [@stef\_pf](https://forum.knime.com/u/stef_pf)\
**Post date:** [October 31, 2023, 1:01am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/5 "2023-10-31T01:01:49Z")

</div>

Hi,

Thank you, the community is very reactive.

Best Regards.

---

<div class="post-metadata">

**Author:** ![stef\_pf](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/cc9497/32.png) [@stef\_pf](https://forum.knime.com/u/stef_pf)\
**Post date:** [October 31, 2023, 1:04am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/6 "2023-10-31T01:04:42Z")

</div>

Hi,  
We took a different approach, using lots of nodes, with no results.  
And here, in just four nodes, the result is there, thank you.  
Best Regards.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [November 7, 2023, 1:04am UTC](https://forum.knime.com/t/filter-row-by-following-order-with-loop/74791/7 "2023-11-07T01:04:49Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
