Searching for Multiple Values in String.Contains

Hello everyone,

I am trying to filter this list with multiple values using the String.Contains node. Right now the values are, {“AC3”, “bleachers”} but in theory I would like to use as many values as needed {“AC3”, “bleachers”, “…”, etc}. What do I need to do to make these values run correctly through the List.FilterByBoolMask node? Thanks for the help!

1 Like

Use the String.Contains from the archi-lab Package instead:

6 Likes

Dynamo Version

Thanks for taking the time to help @salvatoredragotta. The only String.Contains node that I have is the one that is shown in my original image. That looks like what I am wanting though. My archi-lab version is 2018.0.6, in Revit 2016. My Dynamo version is posted as an image above. Are you on another version?

2018.0.6 is the most recent version of Archi-lab. You should have it.

Part of the problem is that you’re not lacing properly. You can use list levels to check for each string individually, then find where any of those strings exist with List.ContainsItem.

7 Likes

The package is Archi-Lab Grimshaw

image

Thanks to the both of you @salvatoredragotta @Nick_Boyts! I checked and it was because my Dynamo was not the latest version, now I have the correct String.Contains node. Awesome!

Great! Please mark as solved :grinning:

Hello,

When i try to filter a string of layers using a list of keywords, the only keyword that is used to filter is the first one in the code block list. I have tried changing the lacing within my string.contains to cross product and then flattening the structure to match my boolmask, but it still fails. The snip is showing the result without the cross product lacing.

I think i’m just missing something minor, so if anyone has a suggestion please help me out. Thanks!

Thanks @salvatoredragotta. This solution just relieved from from about an hour of stress.

1 Like

I have downloaded the Archi lab package, but there is no such node there

I marked this as solution since it avoids dependencies, always preferable to using packages if it can be avoided (less maintenance). Thank you

An couple of out-of-the-box solutions too :slight_smile:

2 Likes

This is searching text with an OR condition. Really nice. How about searching text with an AND condition ?

Hi @lapis ,

Instead of using List.CountTrue you should use List.AnyTrue for OR, or List.AllTrue for AND. Just make sure to set the lacing to @@L2

2 Likes

I should have known….
Many thanks!