Modell-Suche Scripten

Sometimes a question can not be answered with a single SQL query. In order to still use the model search, the search can also be scripted.

We write a script (mySearchScript) and programmatically run through the model. In the script itself we can of course use SQL queries (myQuery). The result of the SQL query can be processed further in the script. For example, recursively run through the Project Browser tree and collect all Package_IDs of all sub packages. We can use the resulting list of all Package_IDs of a package branch in an SQL query to check all model elements in this package branch.

So that we can also call our script via the model search, the script must be located in the ScriptGroup “ModelSearch”. Otherwise, we will not find it in the “Scripts” category in the model search.

If we create a new script in the ModelSearchGroup, we get an executable example. Now we can simply add our search conditions. Creating the necessary XML file is already done by the example script.

 

 

 

As an alternative to the script in the ModelSearchGroup, the script can also be located in a ProjectBrowserGroup, then we can select the script from the context menu of a selected package in the ProjectBrowser.

 

 

 

 

 

 

Posted in Enterprise Architect, Model Search
Tags: ,