Prerequisites:
To create a Requirements Coverage by Design Elements Legend
- Create a Legend.
- Create a Legend Item named '0%-25%'.
- Right-click the Legend Item and open its Specification window.
- Click three dots next to the Elements by Condition property to edit it.
- In the Elements by Condition dialog, set the Element Type to Requirement.
- Rename Custom to Query.
- Select Create Operation > Operation from Model > All Leaf Requirements Owned Recursively.
- Select Input > Reset.
- Select Input > Contextual Variable.
- Select All Leaf Requirements Owned Recursively > Edit > Copy.
- Select the root node Query > Edit > Paste.
- Select the copied operation > Use as... > Input of a New Filter.
- Select Predicate > Nested Operation.
- Select Body > Operation from Model > Not.
- Select A > Reset.
- Select A > Operation from Model > isEmpty.
- Select Input > Simple Navigation. Select Satisfied By and set Is Applied to true, and Direction to Source To Target.
- Select All Leaf Requirements Owned Recursively > Use as... > arg of a new Script.
- From the Language drop-down list, select Javascript Rhino.
Insert the following script as the Body:
JavaScript Rhinovar lowerBound = arg3.name.slice(0,arg3.name.indexOf("%"))/100 var upperBound = arg3.name.slice(arg3.name.indexOf("-")+1,arg3.name.lastIndexOf("%"))/100 arg2.size()/arg1.size() > lowerBound && arg2.size()/arg1.size() <= upperBound
- Drag-and-drop Filter onto Create parameter to create a second parameter for the Script.
- Select Filter > Remove.
Select Create parameter > Element > select the Legend Item for which the expression is defined.
If you cannot see the Legend Item, make sure the Search for option is set to Any Element.
- Clone the created Legend Item and rename the new items accordingly:
- 25%-50%
- 50%-75%
- 75%-100%