How to transform a flat list into a list @level

Hello community,
I’m trying to transform the flat list in the picture bellow (which is the output of a MySQL request) into a tree list with 5 levels: building name [index 0] > level name [index 1] > Super family name [index 2] > Group name [index 3] > Rest of each sublist [index 4 to 6].
Thank you in advance for you help!

what do you mean by flat list?

I recommend posting an example of what you’re wanting in the end. It’s a little hard to understand exactly what you’re after, but you might try the List.Chop node to break your list into sublists.

Of course the first thing you’ll have to do is convert index 5 to an actual list. Right now it’s just a single string with line breaks. You’ll have to use String.Split to break those lines into individual objects.

Just curious why you need a complex list structure like this? Maybe try a dictionary instead if it’s just for organization…

1 Like

The objective is to ensure a data continuity between quantity surveying and design team. The idea here is to push quantity take-off sheets data created at the tendering phase to Revit modeller in the form of catalog of material with predefined parameters.
My input data are hosted in a MySQL database. The SQL request to be pushed to modeller contains this data :

So I need to build a tree list view from this input list to allow the user to choose a predefined article belonging to a material group, to a super family, in a level and in project building.

@maroua.sbiti did you try List.Transpose ?

1 Like

Hi @maroua.sbiti ,

Use the node List.GetItemAtIndex with the list level set to 2.