Search function


#1

I am trying to find all model elements of a given type that have a comment. Is there a way to do this? I am using VP Professional edition.


#2

I hardly use the search options myself so I could be overlooking something, but I don’t think the search feature provides a way to specifically search for a comment to be present. The main problem is that the search feature doesn’t only check the comment section but does so besides checking for the model element names:

At the rist of stating the obvious (you might already know this) but I hope you are aware that VP can show an indication if a model element contains a description? That could be useful. Another possible option (although it doesn’t exactly do what you’re asking for) could be to use the model explorer pane:

So: if you make sure that the ‘model indicator’ option is enabled (in the toolbar, I highlighted the option) then all model elements which have a comment will display a small icon in the lower left corner. Obviously this won’t help you when you need to check multiple diagrams.

As such maybe the model explorer can help. You can show this by using the panes option which I also highlighted. It provides 3 sort options: By name, by type or customized. So if you expand everything (using the 2nd option in the panes toolbar) then sort by type (3rd option) it will group all elements of the same type together.

Press control-shift-i, this will show the description window. Now just skip over the model elements and you’ll see right away which ones have a description:

As you can see the model explorers contents look quite different (the sorting order) and element types are grouped together.

Now, I could imagine that this might not be useful if you’re working with a huge project. In which case I might have 2 more options…

First: we could “abuse” the doc composer. It can be used to iterate over the entire project in order to extract certain information. But it can also easily iterate over the model elements inside a diagram:

<?xml version="1.0" encoding="UTF-8"?>
<ProjectBaseInitiationBlock>
	
	<Text style="@heading+">Use Case Diagrams</Text>
	<ParagraphBreak/>
	
	<HasDiagramChecker diagramType="UseCaseDiagram">
		<ForEachDiagram diagramType="UseCaseDiagram" ignoreLastSeparator="false">
			
			<Inline template="Basic"/>
			
		</ForEachDiagram>
	</HasDiagramChecker>
	
</ProjectBaseInitiationBlock>

This is the default “Use Case Diagrams” template which would iterate over all diagrams, select the use cases and then add those to the report. It should be simple enough to change this: make it iterate through all diagrams, then through all model elements inside that diagram to find the elements you want and then check those for a description to be present.

The last option would be to write a plugin, but I think a doc composer template is a much better idea. Also because you’ll be able to access any finds directly from within the doc composer.

Which leads me to: what model element are you looking for?


#3

Thanks for the detailed answer.

I was aware of the doc composer but I was also trying to avoid learning the xml syntax in order to achieve such a basic thing as search and filter.
My team is (ab)using VP for database modeling and (among other things) to keep track of data flow specifications at the Entity Column level (think data warehousing ETL), which can get complex. Keeping comments for various elements allows to monitor what is still left to be done/clarified regarding those elements, for example I have comments for dependency relationships.


#4

I am new here, but I would also like to thank you for this info.