问题
There doesn't appear to be a way in the model search feature to limit results to a specific type e.g. Class, Node, etc. Is there a way to achieve this? I know I can craft a SQL query however an unable to find the correct table name.
EDIT
It appears that I can do the following
Select *, Object_Type AS CLASSTYPE, Name from t_object Where Object_Type="Node"
.
It seems that Sparx don't appear to have documented Object_Type
as it displays as Type
in their documentation.
回答1:
There is no standard way of narrowing the results of a built-in search by entering something in the Search Term box.
If you create a search using the Query Builder, you can specify that the search should only return elements of certain types. In the Add Filters dialog, the element type is referred to as ObjectType
.
It is possible to utilize SQL string manipulation functions to implement an SQL query which breaks down the <Search Term>
into parts according to some syntax you decide on, allowing you to specify both a name and an element type, say (but none of the built-in searches do this). This is not possible using the Query Builder.
If you create your own SQL search query, as you've noted, t_object.Object_Type
contains the element's type.
Regarding the documentation, it's only the database schema that is undocumented. The Type
field you refer to is from the Object Model API, and in that API, the attribute is indeed called Type.
In addition, all classes in the API contain an attribute ObjectType
, which identifies the data type. These values are from the ObjectType
enumeration type, and include otAttribute
, otDiagram
, otElement
, otRepository
, etc.
来源:https://stackoverflow.com/questions/19481567/is-there-a-way-to-search-for-an-element-type-in-sparx-enterprise-architect