Replace By condition (list and sublist)

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,

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

@Yna_Db, it doesn’t change anything.

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.

The Node “Replace” have the same issue.

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

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

Thank you for you help.

Clement

1 Like

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

3 Likes

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:

5 Likes

Thank you for all your solution.

1 Like

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