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.
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.
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
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!
Please look at my reply above 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.
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?