The following code snippet includes a class method "test" that runs code to find a class based on the class's name. "test" takes one argument, which is the name of the table:
Class objectscript.findTable Extends %RegisteredObject
{
classmethod test(name as %String="mytable")
{
#Dim result as %ResultSet
#Dim tName as %String
#Dim contain as %Integer
Set contain=0
Set result = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
Do result.Execute()
While(result.Next())
{
Set tName=$get(result.Data("Name"))
&sql(select position (:name in :tName) into :contain)
Write:contain'=0 tName, " ... ", name, " (", contain,")", !
}
Return $$$OK
}
}
Here's a link to the code on GitHub