Multiply items at indeces in list


#1

I have two lists, one contains room types and the other has quantity (see Image 1). I am trying to take any item that has a quantity of greater than one and insert however many extra copies of that item into the list. Is there any easy method to achieving this?

Image 2 (blank) & Image 3 (annotated) show the closest I have gotten so far… I tried to extract the index values for any quantity over one then use the List.FilterByBoolMask (s) to isolate the associated items and generate sublists of their multiples. I feel like the List.ReplaceItemAtIndex node is somehow the key. Replacing the original list by pairing the sublists with their associated index value then flattening would do the trick but I cannot figure out how to make it work.list multiplication 1 list multiplication 2 list multiplication 3_annotated


#2

list multiplication 3_annotated

 

 

 

 

list multiplication 2


#3

Morning Kyle,

Try “List.Combine” + “List.OfRepeatedItem”. It should also be doable with replication guides:

2015-08-14_10-40-17


#4

Exactly what I needed, and with far less nodes. Many thanks Dimitar!

list multiplication 4_solution