Replace non booleans in a list

Hi,

I have been digging in the forum but can find anything around this…

I want to replace the non booleans in this list by a true value. What is the condition I’m looking for? how do I formulate it?

replace true

Thanks!

I’ve found a way around, using “replace items at index” as I have the list of the numbers in my mixed table. Still, if somebody could help me with the query above I’s be glad.

 

thanks!

M

Hi Maria,

I think your looking for this.

Untitled

Untitled1

 

 

 

Yes! thanks Kulkul.

Hi guys,

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 “Boolean Input to Variable String Output” from bakery nodes, “Combine by Pattern” from archi-lab nodes and also replacebycondition node. However I didn’t succed with any of them.

Replace true values and remove false values

 

 

 

 

 

 

 

Just for making more clear my approach is from the first boolean list to get the following list:

[0] List

[0]2011200

[1]null

[2]null

[3]null

[4]null

[1] List

[0]null

[1]null

[2]null

[3]null

[4]null

[2] List

[0]null

[1]2971200

[2]null

[3]null

[4]null

[4] List

[0]null

[1]null

[2]1080000

[3]null

[4]3414576

[1] List

[0]null

[1]null

[2]null

[3]2971200

[4]null

Thanks for your time and help :slight_smile:

Best regards,

Alejandro Mata

 

 

 

Hi Alejandro,

 

here are two ways i found to solve your problem. I prefer design script option for obvious reasons :slight_smile: I really don’t know why a can’t use list.map with replacebycondition…

 

1 Like

Hi Mostafa,

Thanks a lot for your quickly answer and great solution. You are really good! :wink:

Finally thanks to your help I managed to get the list of values that I was looking for.

 

 

 

Actually I didn’t know that you could use the programming language “Design Script” within the code block note. I thought that the only way of make your costume nodes in dynamo was by making your own python script. That’s why, I started to learn python some months ago.

What do you think that are the advantages of programming in “Design Script” vs “Python”?

 

Have a nice day,

Best regards,

Alejandro

 

1 Like

You are most welcome.

I’m really not an expert in programing … I’m just on the process of learning python too, because I believe it is much more powerfull than design script as it allows you to interact directly with revit API.

Design script came more naturally after a year of using dynamo because it uses the same functions as nodes …

Hi Mostafa,

Thanks for your opinion regarding the advantages of using DS vs Python.

I’m agreed with you that python can be such a powerful tool in combination with dynamo.

Basically with a good knowledge of these, you can achieve with revit whatever you want. That’s why for me is really exciting to keep learning dynamo and python everyday :slight_smile:

Best regards,

Alejandro Mata