Loop End crashes

Hi guys,

I want to extract first and last rows from paired sets of columns (column A - time, column B - signal), appended to each other (AB, CD, EF etc each pair has different number rows). I first transpose my data and then use Chunk Loop Start to take each time two rows, after housekeeping (removing NAs and missing values) and taking first and last rows of each paired set of columns, I want to append the results row-wise using Loop End. Despite all previous steps running through, Loop End always crashes. What I am doing wrong?

Many thanks in advance!

My workflow and sample dataset:
Loop_first_and_last_rows_troubleshooting.knwf (28.7 KB)
four_columns_test.xlsx (203.8 KB)

Why not use Group by node with min/max or First/Last functions?

1 Like

Hi @Dima_D

I think @izaychik63 has a good point with GroupBy node. Forget the loop. This workflow may help you out. The Regex may need some adjustments (not my cup of tea :grinning:)
Find_first_and_last_rows_values.knwf (293.0 KB)

In The loop end the row id policy needs to be set to either ‘generate new ids’ or ‘unique row ids by appending suffix’

Steve

thanks a lot! Very helpful indeed! Was not aware of First/Last function in Group by node. Still quite new to KNIME but like it a lot!

One more thing that I can’t get my head around:
let’s say I want to re-arrange table 1:

|time_1|time_2|
|signal_1|signal_2|
|time_3|time_4|
|signal_3|signal_4|

into table 2:

|time_1|signal_1|
|time_2|signal_2|
|time_3|signal_3|
|time_4|signal_4|

I would do something like:
Chunk Loop Start (chunk=2) => Transpose => Loop End (generate new ids, keep iterations)
But somehow doesn’t work! Loop End is crashing :confused: I am doing something wrong?

Simple workflow and data:
Chunk_Loop.knwf (16.7 KB)
test.xlsx (9.2 KB)

I’d rather use


without loop.

Hi @Dima_D

Maybe not very efficient, but it works. And there are a couple of handy nodes in this flow.
loop_end_crashes_2.knwf (23.8 KB)
gr. Hans

I’m guessing your loop end fails because you now have different column names. Have you checked the ‘Allow Variable Column Types’ and ‘Allow changing table specifications’ options in the loop end as well?

Steve

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