Contents > 8 Defining Custom Design Metrics and Rules > 8.1 Definition of Metrics > 8.1.7 Value Filter

8.1.7 Value Filter

The "filtervalue" procedure evaluates a metric expression for the first element in a relation or set, and returns the result of this metric expression.

The following example uses the "filtervalue" procedure to access the data value of a particular tagged value pair. We assume elements of type "taggedvalue" have two metrics "TagName" and "TagData", which yield the name and data value of the tagged value, respectively.

<metric name="Author" domain="class">
  <description>Author of the class.</description>
  <filtervalue relation="context" target="taggedvalue" 
               condition="tagName='Author'" value="tagData"/> 
</metric>
The above metric takes the first tagged value with tag name 'Author' that it finds, evaluates the expression specified by the "value" attribute for that tagged value, and returns the result of that expression as the result of the metric.

The "filtervalue" procedure has the following attributes: