Duplicate List Elements

Hi All,

As shown in the below image I want to filter out List Elements of a certain length and insert them into the original list to act as duplicates. I.e. for this case I wish to duplicate List Elements 3 and 7, however the quantity of duplicates and their list order will vary as my source information is updated. I have tried the Insert node to no avail.

See if this helps

If the line length is greater than 600, it creates three copies of the same

File: lines.dyn (10.4 KB)

ln;
a = [Imperative]
{
	b = [];
	c = 0;
 	for (a in ln)
 	{
 		if (a.Length > 600)
 		{
 			b[c]=List.Cycle(a,3);
 			c = c + 1;
 		}
 		else
 		{
 			b[c] = [a];
 			c = c + 1;
 		}
 	}
	return b;
};

The attachments looks like missing. Is it something you could fix?

This is a post from the old forum, in the transition to the new forum, some things got lost.
Maybe try the wayback machine.

Yes perhaps. Vikram has been fantastic to fix older posts thus wanted to ask him if he could.

1 Like

Not sure if the original file resembles the one I’ve posted above or something like this :slight_smile: