Moving an item from a sublist into another one

Hi everybody,

I have a problem moving an item from a sublist to another. I saw in another topic that a procedure can be remove the item from the old position and insert it again in the new one. But I don’t know what I have to write in the code block to get the index I want to move.

For example I would like to move the item “b” from sublist 1 into sublist 0 at the index 1.

Thanks in advance for help.


Something like that?

Hi Salvatore,

thanks for your post, your code is very interesting, but it’s not exactly what I’m trying to do.
I would like to delete the item “b” from sublist 1 and add it in sublist 0 at position 1 for example, the resulting list should be this one:

I tried to apply the remove and insert nodes, but I don’t know what to write in the code block to get directly the index (or the indices) I want to remove:

I was only able to do this:

but I have to move a lot of items so this procedure is too long, and I think not efficient.

@rosarixx Try this one :wink:

def replace(lsta:var)
lstb=List.AddItemToEnd(lsta[1], lsta);
lstb[0]=Reorder(lstb[0],{1, 0, 2, 3});

1 Like

Another way, should be fast:

1 Like

Well thanks guys, you give me very interesting material to study.