Challenging (?) Task - Grouping Marked Rows

Hi all, I’d like to throw this out. The input table has this pattern:

PA

The task is to use the marking from Column 2 to group together rows from Column 1 to get this table:

PB

The solution must satisfy these conditions:

  1. The first row can sometimes be marked X on Column 2, and can sometimes be a missing value.
  2. The last row is always marked X.
  3. I’m looking for a fully automated solution.

Please have a go at this.

Thanks!
:person_gesturing_ok:

@badger101 you could adapt this workflow and use the blocks to fill in the desired markers with a Counter creator and the use the Group By node to create the “Group Members”. Maybe you upload a file that would represent your complete task

2 Likes

@mlauber71 The group loop method was one of the first things I’ve tried. It won’t work since my markings are not unique. The tables you see represent the true pattern of my dataset.

Update: Ah never mind what I said, I see what you mean with the Rule Engine. Let me have a try on that. Will update here.

1 Like

If you could provide them someone might have a try :slight_smile:

Done! Thanks to your suggestion with the Rule Engine+Counter, it works now! The only difference is that my table will use the ‘Next value’ for the Missing Values replacement. @mlauber71

1 Like

Hi @badger101

See this wf challenging.knwf (44.7 KB).


gr. Hans

4 Likes

Thank you @HansS , you were 1 second late :rofl: But I love that your solution doesn’t require looping. Can be a great alternative for larger datasets.

2 Likes

Without having the table I assume Moving aggregation should also do the trick
br and enjoy your weekend guys

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