pivoting

Hi everyone,

I have two tables (attached) and wish to create a table in the pivot table (also attached) for all rows in table 2.

I couldn't find a way to to this. I tried several loop options but didn't get the desired result.

Any ideas will be highly appreciated.

Thanks in advance.

 

Bora

I suppose this has something to do with your other recent posts? So you're splitting strings, which then give you the elements in table_1? One simple solution would be to keep your original sentences, and use them as pivot groups. You can then remove this column and rename columns. If the names have to be provided in a table, you could e.g. use a Regex Rename in a loop (might have to be a double-input recursive one... yes, complicated, I know...)

But if you know the structure of your data beforehand, you might want to look into the Regex Split instead, without manual splitting, pivoting, loops, and everything. A really fancy solution could build the parameters itself from table_2 via String Replacer, GroupBy, Table Row To Variable, and maybe a Java Edit Variable, but that's almost certainly overkill.

Hi Marlin,

unfortunately this post has no connection to previous ones. I have two tables as you have seen in the attachments and the column in table 1 contains column headers for the data in table 2. Yes, I know the structure of data in table 2 and this has to be working to my advantage. Yet, I couldn't accomplish the table like pivot table in my example.

;I tried recursive loop adn several others, but it didn't work as well. I am a non-coder therefore I am trying to find a solution without java snippet option.

 

Ugh...

Ok, so for pivoting, you have to assign a tag to each group. The easiest way seems to be a Math Formula with something like "($$ROWINDEX$$ + offset) / groupLength"

Oh, and concerning renaming: I just remembered Extract Column Header and Insert Column Header. They might help.

I just looked a bit closer, and either your structure varies or your data is not preprocessed correctly. Either way, you have a different number of items in different groups. If that is correct, you could try to adapt this solution.

Also, if you add an indicator to every row to indicate what column it will be,  (e.g. via "($$ROWINDEX$$ + offset) % groupLength") and a second one to your header table (e.g. via a Counter), you can then join both on that index, pivot, and column renaming becomes a simple Regex Rename from something like "(.+)\+.*" to "$1"

I got what you meant Marlin, but can't find the exact way to go there.

I have 7 column headers and a data table with one column which is actually grouped in chunks of 7 rows.

I tried your indicator formula and every chunk of 7 rows starts with an integer now. However, what I need is 1,2,3,4,5,6,7 for each row in every chunk of my table.

I think I need some fresh air to clear my mind :)

Actually, you need both. And actually, your data is not grouped in equally sized chunks. I appended a Workflow which does what I was talking about. I had to use different offsets, because there is no integer-div in the Math Node, but the principle is the same. However, when you look at the result, you will see that at some places the data is out of sync. These are the places where your data group actually consists of more or less than seven rows. That's why I said you might want to work on your preprocessing or look at the other solution, depending on what you need.

Yeah, I realised that I attached the table without pre-processing. My bad :)

However, I think the example you attached will seal the deal.

 

thanks a lot, Marlin.

 

Berst Regards.

 

Bora

yeah, this works great.