Using multiple search for items in "String Contains"

Hello everyone,

I get confused with “String Contain” node again and again when using multiple search for items with it .I have seen a few reference in this forum but still could get the right result while using it. Please take a look in this small example shown below and help me with it.


In your case, you tried to
find “f” from list {“a”…“h”},
find “e” from list {“c”…“g”},

That the reason you get these true and false.

@Raja If you only have two items to search for, you could try this …
stringContains.dyn (5.1 KB)


Many thanks @Vikram_Subbaiah works well now. How could i handle if there are more than two items to search for since first and last item can’t be used in that case.


1 Like

stringContains.dyn (5.7 KB)


Thank you very much @Vikram_Subbaiah.



What do you want to do with the objects once you have found them ?
You could do something with a temporary database that you write to and then query


Hello @Andrew_Hannell ,

The main goal is to filter the area of the Balconies and Terraces in the apartment to find the net area for quantities. In the future the filter can have additional areas like common spaces in the apartment and so on. At first i was thinking to sort the room parameters by name and extract only the data like Name, Level, Area etc., which couldn’t be done because the Elemenet.Parameters can’t be sorted alphabetically (as show in the picture) and also it was difficult for me to map it after filtering. So I retained the same list order of the parameters and used the mutiple items in string contain to achieve the thing I wanted.

Probably using SQL Lite query could do the job quickly but still I am not aware of how it works. I would be glad to hear an proper solution for this from you all.

You haven’t looked at Element.GetParameterValueByName?


Hi @Vikram_Subbaiah, Yes I have looked at it.

But I dropped it since it took a long way like grouping all the rooms according to the apartment and deducting the balcony area from it then assigning the parameter value of “Net and Gross Area” using the “SetParameterValuebyname” to the shared parameters for each room of those apartments.

The soultion given in this post worked very well and solved the whole problem :slight_smile:

1 Like

Hi guys!

I created a list to input in the node “String.Contais”, but the result is empty list. If I use a single string to input in SearchFor it works, but it not works with a list.

The first image below shows the script using the list, and the second one shows only one string.

Can anyone help me?


modifyViewrange1.dyn (40.9 KB)

Hello @mauriciolimax,

Try changing the Lacing on the String.Contains node to cross-product (Accessible through right-clicking on the node).

Hello @solamour

I tried to do that you said but not worked. You can see in the first image below.

I’m using the list because the next step of my script is import from excel the values of “Level name” and “view range”. You can see that in the second image below.

Thanks for the help!!!



There are some List level issues - apologies that I missed them! Try the following graph :slight_smile:

mauriciolimax_FilterUsingStringContains_CrossProduct.dyn (22.2 KB)


Hello @solamour

Thanks, I appreciate it! it really helped!!! :smiley:



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!

Hello @bergmanF94BD,

Please look at my reply above :slight_smile: You’ll need to use Cross-product Lacing on the String.Contains node, then also use a List.AllFalse node with List@Level 2 enabled and a Not node.

What this does is it takes your input strings (Your CAD.LayerNames) and then checks them against every single string you want to search for (This is what cross product does), providing you with a List of lists of boolean values (Trues and Falses). As you simply want to see if a layer contains any of your matches, then you can use the List.AllFalse node at the L2 level to check if they are all false (Which means there is no match). We then use the Not node to flip Trues to Falses and Falses to Trues - to make it a little more sensible to feed into the List.FilterByBoolMask node.

1 Like

Hi @solamour, thanks for the quick response!
So i tried that yesterday and just now again and it still isn’t working. For some reason I think my list structure (or something) is backwards. My CAD.LayerNames is being checked against the list in my code block instead of the list being checked against the layers. So instead of each layer having a sublist of true/false for the 18 keywords, I’m getting true/false for the 18 keywords based on if any of the layers have the keyword values. Does that make sense?

@bergmanF94BD - Ah, I see the problem! Your list coming into the String.Contains node has a deeper rank than my use case (Single list of elements)… Try what is below!

Your input is a List of lists of lists :slight_smile:

And the graph is attached here too!

bergmanF94BD_NestedListAtLevels.dyn (13.3 KB)


@solamour That worked! thank you so much, list structure is always what gets me.

1 Like