need help with correct data split

Dear community.

Need some advice and help.

I’m looking for some elegant solution for next case.

I have a set of checkpoints and corresponding times when they have been passed. I need to split that set into separate tracks. Track is a sequence of checkpoints where difference in time between current and next checkpoint is less than 30 minutes. In my example first track finishes with 13 row, second with 17, and so on.

I know that GroupBy node can be used for that, but i have to define somehow additional parameter, that will be used for grouping, that will have same value for the same track.

What is the best way to do it?

tracks.xlsx (6.4 KB)

Hi @alex_never

Take a look at this workflow sequence.knwf (59.0 KB)


I don’t know if it is the best way to do it. But it works :grinning:
gr. Hans

3 Likes

Hi Hans.

Thanks.

The result is exactly what I needed. Only for the last entry the sequence has to be manually updated.

I was also thinking about lag node and further time comparison, but hadn’t came up with the solution for sequence generation like you did.

Thanks again.

2 Likes

Hi there @alex_never,

here is another solution where Column Expressions node is utilized. Last entry is also updated.

sequence_ipazin.knwf (68.0 KB)

Br,
Ivan

2 Likes

Hi Ivan.

Solution with only 2 nodes - that is really an elegant one!

Now column expression looks like a programming unit )

How code can be updated, so that the rows that are > 50 already counted as next track, means +1. In current solution they will be grouped as last checkpoint in the track. But they should be the first in the next track.

BR,
Alex

1 Like

Hi there @alex_never,

instead of i++ (first returns value and then increments) use ++i (first increments and then returns) :wink:

Br,
Ivan

1 Like

Thanks, Ivan.

Now it is perfect solution!

BR,
Alex

1 Like

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