Replace By condition (list and sublist)

dynamo

#1

I have a problem with Replace By Condition Node.

When I have a list wich just one item and sublists, the node doesn’t work. The warning is “_Converting an array to var would cause array rank reduction and is not permitted”.

but if I have a list only with sublists (even if sublists have only one item), it works.

Do you have and idea :

  • either to convert list to have all item in sublists. I tried with List.slice but It doesn’t work very well.
  • or a node like Replace By condition to works with any list structure ?

Thanks,


#2

At first sight: see if feeding the “y” input of the == node instead of the “x” makes a difference


#3

@Yna_Db, it doesn’t change anything.


Replace item at index
#4

You could try it with “replace” nodes since your values are strings. Furthermore, they offer the possibility to play with levels. Try also those in DanEDU or Clockwork packages.


#5

The Node “Replace” have the same issue.

I found TurnintoList node, from clockwork, and it can replace the node List.Slice.

So, with tun into list, Replace By Condition Works :slight_smile:.

Thank you for you help.

Clement


Replace item at index
Replace items in sub-lists
#6

@clement.cazi You could try this work around too …


#7

You found one of the limitations of imperative code - mixing singletons and lists can be tricky, you usually get a “Rank Reduction” exception. If you want to stick with nodes, one way to get around this is to manually use function mapping techniques:


#8

Thank you for all your solution.


#9

5 posts were split to a new topic: Replace By Condition (with Any List Structure)