Replace in list By Condition

Hello! i want to replace all instances of this list with a “o” string if the value is not “-1”, can anyone help out?

Kind Regards :slight_smile:

A simple if statement in a code block will do: val == “-1”? v: “o”;

3 Likes

hello


Mr. Jacob’s solution is more efficient
cordially
christian.stan

3 Likes

This worked! Thank you so much!

1 Like

It’s definitely more efficient

(if you ever had trouble writing)

cordially
christian.stan

1 Like

I am still new to Dynamo, having trouble to write in code block :slight_smile:
Thank you so much!

1 Like

Thank you so much!

4 Likes

Thanks a bunch! i will be checking it out!

I’m a little confused; I set up this ReplaceByCondition as below, but it is telling me that the “condition” input requires a Function input as opposed to a boolean.

The function should be something like the < node without the X input (or whichever input is the list in which you want to replace something).

Without seeing the input context we can’t directly help if you’re looking for something else though. Perhaps some design script ali g the lines of a<5? “NaN”: b;?