Some operations on lists - help needed


I am trying to do some automation reorganizing lists originating from excel.
I cant figure out how to approach this one.

What i need is to analyze data row by row and create downstream hierarchy list for each row.

I feel like using traditional gh components woul not be effiecient. Do you suggest any script? Or how would you approach this?

*i see the definition is not correct. data is truncated when next row is the same or higher hierarchy than row which is being analyzed


Can you post the gh file with internalised data?

ok i am going to create sample data but situation changed a bit i realized transposing rows and columns are easier way to handle excel data so this whole thing will be a bit different but the goal is the same

So this is excel data which can be found also in .gh file attached. It is ordered that each branch is a row in excel and indices are columns. (4.6 KB)

What i want to achieve is that for each row in the excel table i want to obtain all items down to the item whose hierarchy is the same or higher level than analyzed row.
In gh output should be that for each branch (which is one row) there would be 5 subbranches corresponding to columns with indices corresponding to rows.

Picture is very bad but i hope my intention is clear

Basically i need sub table for each row which confines the structure up (down) to the point when item higher in hierarchy occurs.

The spreadsheet data is a bit of a mess, eh?

Here is a reformatting of the data, warts (duplicate data) and all, using Anemone. (11.9 KB)

By the way, are @ivan.galik and @Juan_Gallo the same person?

The white group cleans out rows with missing and duplicate data to leave 29 valid rows. (16.6 KB)

Yes one si private account one is firms.
I am going to have a look at your solution. It looks promising. I could think this has to be done in loop. Thank you so far :slight_smile:

When I added code to break the Anemone data into branches, I discovered another ambiguity caused by “bad data”: two branches are combined… Looking deeper, I found an error in the white group. :frowning:

This qualifies as one of those “painted myself into a corner” problems that ultimately are not fun since they could have been avoided by different actions earlier in the process (the Excel file in this case).

I will tell you why i am doing this. In excel you define your whole project structure with all contents and annexes. Using GH i plan to create title sheets. Special option is to include list of annexes belonging to each rows structure. Whole point of this data operation is to get table of contents for each row, which is bound by according to rule of subsequent higher level item than in original row.
Just to get picture behind that arbitrary data…

I get the picture. The empty cells in the spreadsheet create needless ambiguities in the data.

its not best for data operations but it is how humans will put it down in excel :frowning:

I’ve squandered too much time on this, setting it aside. Bad data!
Apparently @Juan_Gallo and @ivan.galik are the same person? Why?

One si private account one is firms :slight_smile:

So it’s an alias (“sock puppet”)? Both names are bogus? Not surprised the data is sketchy too.

No no Ivan Galik is real name Juan Gallo is a joke spanish version :smiley:
Data is exactly how it will come from excel. Just hierarchical structure with lot of empty cells.

I found a guy who coded it in c#. I am surprised how easy it seems.

So far the first part of the script is done which fills in empty cells. (7.8 KB)

This can be handy if you want to complete the hierarchical list without manually copying identical data