Concatenate data in a column for a number of rows

In a column “Conc and Effect” are for example the following data:
(10,97)
(4,98)
(0.64,92)
(0.102,64)
(10,91)
(4,83)
(0.64,78)
(0.102,63)
Now i like to create a new column with concatenated data per 4 rows
and this should look like this in each of the 4 rows.
(10,97),(4,98),(0.64,92)’(0.102,64)
(10,97),(4,98),(0.64,92)’(0.102,64)
(10,97),(4,98),(0.64,92)’(0.102,64)
(10,97),(4,98),(0.64,92)’(0.102,64)
(10,91),(4,83)’(0.64,78)’(0.102,63)
(10,91),(4,83)’(0.64,78)’(0.102,63)
(10,91),(4,83)’(0.64,78)’(0.102,63)
(10,91),(4,83)’(0.64,78)’(0.102,63)
So each time the data of 4 rows are concatenated.

preferably only the concatenated data in first row and then 3 empty rows and then again concatenated data in a row and again 3 empty rows.

Don’t know if something like this is possible

Already thanks

You could use a Chunk Loop and bring the Rows into a List, then split it and recombine it.

kn_example_concatenate_columns.knwf (41.0 KB)

Hi mlauber,

thanks for your answer, but this covers not completely my problem. My file contains a number of columns. And the data of the other columns should stay with the concatenated data.

I have added three files.
The file “Chunk_example_file_input.txt” is the start file
Chunk_example_file_end.txt (39.4 KB)
The second one “Chunk_example_file_inbetween.txt” is added a column “Concatenated”. I here first “(” and the data of “Data” and a comma and the “Effect” column and “)” is concatenated. And in the “Concatenated_all” column the data of the “Concatenated” column the first 16 rows are concatenated with a comma in between
Chunk_example_file_inbetween.txt (39.4 KB)

And in the last file “Chunk_example_file_end.txt” the data is sorted on the concatenated all column.
Chunk_example_file_input.txt (26.1 KB)

Hopefully this make sense and is it possible to create something like this

Thanks,

Ron

Hi Ron!

Maybe this workflow will help:

Group 4 rows.knwf (33.1 KB)

Br,
Ivan

Hi Ipazin,

thanks for this solution. I had never thought to use the MOD function for this and was not aware of the LAG function. This helps me to do this part and I can continue now with the workflow.
One other question is about combining the data from different columns. The data in this example with 4 datapoints is just an example. In my response above to mlauber I have added the real data files and look a bit different, I explained the whole situation and a part of this is to combine the data from the columns f.i. 4,5,6,7 but each data should be surrounded by brackets and look finally like this (4),(5),(6),(7).
So if there is a function to combine columns with in between concatenate the brackets would be great

Thanks,

Ron

Hi Ron!

After Column Combiner you can use String Manipulation node or Column Expressions node to manipulate string in order to add brackets where you need them. You can use replace function or regexReplace :wink:

Br,
Ivan

Hi Ivan,

I will try these options.

Thanks again,

Ron