Replace non boolean

Hi all,I’ve been trying to convert the true values of a list by a numeric values from other list and remove the false values also. I’ve been using design script which was posted long back. But it is not working. Where I did wrong? or any other solution.

Thanks
Ilayaraja P

It’s doin exactly as expected, Applying the numeric list to each boolean sub-lists. I’m going to assume your only problem is with the null values. Otherwise, it’s about lacing.

Unless you can modify the design script, I suggest you use nodes. It does make things longer but it’s sometime crucial for the sake of clarity and reusability.

Go for a filter by bool mask and a remove null( lunchbox ) to acheive the same goal. Or just plug a remove null after your graph.

Thanks @slepagetrudeau for your reply
For Example I have 20 nos of true and 20 nos of numeric value. I just want to replace the true with numeric value. In your example its repeating the numeric value ( 2 & 3) base on the sub list number. Also I dont want to remove null and this null will be replaced by black sub list later. I hope you got my point.

@pilayaa

Are the sub lists important? Could you flatten the whole thing?

Your list structure certainly doesn’t match. You have 23 numbers and 68 booleans (and it doesn’t even look like 23 lists of booleans).

What is your overall goal? What are you checking the numbers for?
A better explanation of your process will allow us to give a better solution.

Thank you all for your reply.
@slepagetrudeau, Yes the sub lists are important. This is for part of the electrical Distribution schedule. I will replace the null with black value later.
@Nick_Boyts, I have 68 booleans. In that I have ‘23’ number of true and ‘23’ number of numeric values. I just want to replace the true with numeric values.
@erfajo your solution works until we have one true in the sub list. If we have more than one ‘true’ it will repeat the numeric value. See the below snap for more clarity.

Thanks
Ilayaraja P

@erfajo, You are right.

Is the sublist always 4 items deep?

Thanks @erfajo for your time and suggestion.
I replicate the same what you did. But its not work for me. What did I wrong?

I don’t have an idea about python script. That’s why I couldn’t find the error. Thanks for your help and .dyn file. I will check and let you know .

Hi @erfajo
It works now. Once again thanks for your help.