Opposite of "List.Create" node

Have you ever needed a node like this???

Very often i need to decompose a list to access separately to the item and everytime I have to create a code block like that: an annoying waste of time!

I think it could be very useful to have a node that is a kind of “opposite of List.Create node”…

What do you think about???

List.Chop
image

yes…i know…

but I’d like to have separate output like in the code block.

what’s it for? It seems to be a bit paradoxical but a list structure is already pretty consecutive and discrete.

Simply I need to do different operations on every subList…

Imagine for instance you have a series of data of different type (list):

sub0=list[0] --> string
sub1=list[1] --> string
sub2=list[2] --> double
sub3=list[3] --> date

Two task:

  • transform all elements of sub2 to string;
  • set a date format to all elements of sub3;

Easy to do with python, but sometime is easyer to use available nodes…

Something like this:

It looks like a switch statement thing…let’s call some help… @Vikram_Subbaiah @kennyb6 @jacob.small @Jonathan.Olesen

somehow I guess it’s achievable by Dynamo API (if there is…), like programmatically add a number of nodes and connect them to upstream automatically.

Like adding 25 (List.Count()) ItemAtIndex nodes then connect them to the List.

Let me know if I understood you correctly. You want a node that has an automatically expanding OUT based on the count of the list? That would be an interesting thing I suppose, but with limited uses and I am not sure if that is even possible, as there is no way to activate/deactivate nodes automatically/based on another node’s statement.

Lol I crashed my Dynamo trying to type OUT[0…List.Count(inpList)]

http://dictionary.dynamobim.com/#/Core/List/Action/Deconstruct

this would work if there were only two items in the list, or you could use a lot of deconstruct nodes together, maybe this could be explored

Well, not exactly…

As with “List.Create” I can decide how many items to add, in the hypothetical “List.Items” node I can decide how many item to get.

A sort of dynamic “List.GetItem”…

Okay basically you want the same thing as the first codeblock in your picture but expands using a +/- controller to save time. I agree it would be interesting and helpful in some cases, I just don’t know how possible that is and if it is worth the hoops you might have to jump through to get it functional. I guess one of the developers would be a better person to ask.

I like the idea of the automatically expanding node for this, and I think it would be possible to write a custom node which does this. That said…

This use makes this hypothetical node inconsistent in terms of behavior… what happens to the rest of your list? What if I only want items 6, 5, 24…49, 137…

Further, passing all those outputs outside of a collector is just going to ruin performance as each output has an impact on RAM. Every time I have seen someone ‘split out’ a list like this, there is a step further up stream where they recombine them in some way. Leave them together and your performance boosts.

Instead, I recommend you look at if statements:

Object type is a date?
Format the date:
Object type is not a string?
Convert to string:
Return the original object;

…if I need specific items I use the “List.GetItems” node.

As usual there are many way to obtain the same thing, but let’s with another simple example:

In this case there is no need to modify the items or to ricombine, but simply to use it as input in different nodes.

N° 5 “List.GetItems” required VS N°1 code block…or “List.Items” node… :wink:

What do you think about?

I’m looking for the same - has anyone figured out a dynamic number of outputs?