How can we help you today?

Finding duplicate interfaces on a component

F

Fredrik Dannberg

started a topic
about 1 month ago

This is an example of how you can use the Script Language to find out if there are interfaces on a component that are defined more than once. E.g. if there are multiple ReceivePorts/SendPorts with the same Sender Receiver Interface.

Example Meta model:

The below report is designed to be run on an Application Component. For simplicity, it only looks at the ReceivePorts and identifies duplicates:

<Report>
<!-- Save all interfaces to variable. By using /part::ARRP.Select(DefObj) instead of /ARRP ... -->
<!-- ... we get a list that can contain multiple occurences of items. -->
<Variable name="allReceivingInterfaces" select="/part::ARRP.Select(DefObj)" as="Items"/>
<ForEach select="/ARRP">
<!-- Save the current interfaces to variable. -->
<Variable name="currentInterface" select="." as="Item"/>
<!-- If the AncestorHandle can be found more than once -->
<If test="$allReceivingInterfaces[$currentInterface.AncestorHandle = AncestorHandle].Count >1">
<Text>Duplicate #{Name}, version: #{Version}, Handle: #{Handle}</Text>
</If>
</ForEach>
</Report>