Search for one or more keywords


#1

I have a graph that searches for a room parameter for the grade. Based on the grade level, the formula to calculate student capacity will take one of three branches. For example, if the Room is a “Fourth” grade class the area per student is 32 SF, but if the Room is a “Fifth” grade classroom the area per student is 28 SF.

My current graph has a separate branch for each grade from PreK to Twelvth. I could simplify this to three branches were it possible to search the text parameter with an ‘or’ string search.


#2

GroupByKey?


#3

You could use an Or statement to check each subelement, or you could just use List.ContainsItem.


#4

I’ll play around with both suggestions tonight, here is a link to my graph https://www.dropbox.com/sh/mgopwzvaj293bps/AAByZJ9r4qJ6YE4oemSdEQeCa?dl=0
As you can see, it gets pretty busy.


#5

I tried both ways. In the first case, how can I account for a variable number of list items and a flexible list of keys?


In the second case, I don’t understand how to apply this technique to a random collection of keywords.

Ideally, I would either create or find a database of all the combinations of identifying grade levels, ideally with misspellings (sort of like a rainbow table of grade names) to use as a basis for sorting all the rooms I come across in K-12 Revit models. This is the graph I am trying to simplify and make more flexible/user friendly.

Even if I didn’t have a complete lookup table of keywords, with enough input keywords, I could cover the majority of what users will call classrooms with simple instructions, like “for this to work, spell grade and don’t use numbers.” Then if the occassional number was used or a common misspelling like “Fouth” I might be able to catch as well.Classrom capacity dy-v2.1.dyn (173.6 KB)


#6

So I bit the bullet and decided to pull the keywords from an Excel file of grade name variants where each column is a grade from 0-12 (13 items in the list). At this juncture of the code, ElementFilter.ByParameterStringValue adds two unwanted levels to my list? I tried several combinations of list levels with no luck. What am I missing? My goal to to have 13 lists of rooms sorted by keywords to normalize to a company standard name. IOW Preprint we can run this script to change rooms names like 2nd or 2 to twwo all to SECOND GRADE.


#7

Figured it out, although maybe there is a better way, using Flatten i played with the amt and list levels to achieve the end result.
List%20level%20question1
Here is the final graph.


#8

So now I’ve hit a new snag when trying to “clean” the room names. In the first case, I created a lookup table of grade name and columns of misspelling variants. Somehow I was able to make it work;


Then I created a much longer lookup table of room names with columns of misspellings and the same node gives me a warning Asked to convert non-convertible types.


#9

I figured it out, somewhere in my list which came from excel, there was a combination of strings and integers. Once I converted all item in the list to strings the node worked without an error.