List Cycle

Hello everyone

I have two list and i want to use Lits.Cycle but unwanted!




Pretty sure we had a similar discussion recently. However the forum search fails me once again. Here’s one solution:


Thank DIMITAR VENKOV very much!

I have one question , why is not the same result as Node List.OfRepeatedItem




That’s a good question, Huynh

It has to do with how the node was set up initially. By default, the node is defined to work with a singleton input for the “amount”(var) and a variable input for the item(var) , so it would try to repeat the entire content of the “item” input once per each individual number in the “amount” input. Because our input is a list of lists(var), we get many repeated lists of lists.
Setting the lacing to longest forces the node to process each pair of input sub-lists individually. So we pair “a”…“c” with 2…4 and “d”…“f” with 1…3. That gets us a step closer but the “item” input still remains a list of objects and we end up with multiple repeated lists(var).

To get to our end goal, we have to somehow ensure that the “item” input ends up being a singleton (var). One way to do this, is to completely flatten the input and set the node lacing to longest. Thus we ensure that “a” is paired with 2, “b” is paired with 3, etc.

If you want to keep the original list structure, you’ll have to recreate it with “List.Chop”.


Thank DIMITAR VENKOV very much!

it’s great, it’s helped me solve my problem.