List of materials doesn't match with the element ID row on Excel

How can I organize my script’ lists to have the ID element in front of more than 1 material on my excel file?

The result I’m looking for :

How do you know which material goes with which element? Can you split your lists by material?

Thanks to Familytype.CompoundStructureLayers I know exactly that the “0 List” goes with the first element, the “1 list” goes with the second element…
the problem is that an element can contain several materials so the rows in my excel are shifted

You definitely don’t want to flatten your list… then you lose your list structure which tells you how things get mapped. The easiest thing would be to show each element multiple times for each material it requires. But if you can only show it once you could try something like this:


Or in a codeblock:
image

And what if I have to apply this to several Lists?
It was applyed just for List 0
33

You’ll have to change the list levels to work with your list structure, but the general workflow should do what you want.

Is possible to give me an example with 2 lists ? :confused: I have tried to change list levels but it doesnt work

I would suggest you look into how list levels work.
Can you show me what your Material List and Element List look like? I’m still a little confused on what your list structure is.

Edit: If you can keep your lists in the same structure you should be able to get it to work like this:


(I also noticed that I had your elements and materials backwards in my first example.)

I have tried to make it work thanks to your exemple but it doesnt.
IF you can look at how my structure is:

I thought you were saying you had several lists, as in sublists. You just mean that you already have Id and Element in a list together.

You need to do this process to Id and Element separately so that every sublist is the same length. Then you can combine them.

Actually it’s this is just a test. I can’t do this separetely for my “real” script because I have 24 differents sublists in it :confused:

Then you should still be able to use the second graph I showed that includes sublists. The important part is getting your sublists (Id, Element, Material) to be the same length - this just means padding the Id and Element lists to match the Material length.

I have 36 elements / 36 Ids but 59 materials that’s why I want to skip rows

You can’t “skip” rows. You have to have a row there with blank values. That’s what I mean by padding your lists (with blanks). If you have 59 materials then you need 59 elements and 59 ids - those extra 23 items are the placeholder blanks.

Yep I got It. That’s what I wanted to say by “Skip rows”, my bad :smiley:

Hello @Nick_boyts,
I have 3 lists with 36 elements. I have also 59 material for these 36 elements.The List.Cycle added to front permits to have lists with same lenght.
The problem is that the node List.AddItemToFront add the correct list.cycle list only to the first list (0 List).
Do you know how can I solve that?

Solution: