# List to Index

Hi, this is my first post, and I appreciate any help I can get.
I have 2 lists that I would like to combine, and I want the values in the first lists to become indices. So, looking at the attached, I would like a list that had 32 individual indices of 850, then 32 indices of 350, etc.
Is there a way to do that?

Welcome to Dynamo Community!

List.OfRepeatedItem should get you what you want.

1 Like

@Andreas_Dieckmann Is this what he needs?

I think he wants to repeat each room area by the corresponding room quantities. So the room area would go into the item input and the room quantity into the amount input.

1 Like

Thanks for the quick replies! I think weâ€™re getting close, but the problem Iâ€™m running into is that List.OfRepeatedItem doesnâ€™t seem to take an array for the amount input. What @Andreas_Dieckmann said is correct. Iâ€™d like â€śRoom Quantitiesâ€ť to define the amount of the correlating â€śRoom Areasâ€ť. In @Kulkulâ€™s example, itâ€™s feeding a single number, which is close, but doesnâ€™t correlate .

When I try adding Room Quantities to the Amount input, it gives me this error.

Iâ€™d like something that looks like this:

List
| 0 List
| | 0 850
â€¦(32 times)
| | 32 850
| 1 List
| | 0 350
â€¦(32 times)
| | 32 350
| 2 List
| | 0 50
â€¦(32 times)
| | 32 50
| 3 List
| | 0 25
â€¦(32 times)
| | 32 25
| 4 List
| | 0 400
â€¦(5 times)
| | 5 400
| 5 List
| | 0 400
| 6 List
| | 0 100
| | 1 100

@case.devisser Right Click "Change Lacing to longest" for â€śList.ofRepeatedItemâ€ť node:

@Kulkul It still gives me the same error when I set Lacing to Longest. Same with cross-product. Your output is exactly what Iâ€™m going for though.

Not sure if the list type has anything to do with it, but my inputs are List.GetItemAtIndex nodes. Theyâ€™re extracting the numbers from an excel file up the line.

Add â€śObject.Typeâ€ť to â€śRoom.Quantitiesâ€ť and â€śRoom.Areasâ€ť and show us what does it says.

You need to convert strings to numbers. Add â€śString.ToNumberâ€ť node to both and then use â€śList.OfRepeatedItemsâ€ť.

1 Like

That worked! Thanks for all the help!!