Setting Selection Criteria
- Last UpdatedMar 26, 2024
- 4 minute read
The Selection Criteria specifies to which elements a rule is applied. Generally the criteria are based on values of database attributes, but it is also possible to filter out shapes fulfilling specified Visio formula. The database criteria can be defined in three ways;
-
Using element type and attribute values
-
Using a pml expression.
-
Selecting shapes without database element
This can be chosen in the Criteria drop down box.

Defining selection criteria using the Type & attribute value option
If the ‘Type & attribute value’ is selected it provides the possibility to select the type of elements to which the rule should be applied and then to define the number of attribute filters. It is also possible to select ‘All types’ which means that the attribute filters will be matched to all elements. To specify attribute filters select the Attribute from the drop down in the Attribute column in the grid. It is possible to use regular attributes as well as referenced attributes. It is also possible to key in the attribute name rather than select it from the list. The attributes list contains system attributes and UDAs valid for the selected type including referenced attributes defined in Attribute Presentation in Diagrams Options. It does not contain pseudo attributes unless they are added in the Attribute Presentation. If there is no type specified for the rule (‘All’ is selected in the Type drop down) the list consists of merged attributes for all database types that can be represented on a diagram. After the attribute is selected, the operator and value to compare should be specified as shown in the screen shot above. A new row for the next attribute filter is added automatically after the current row is edited. To delete an existing attribute filter row select the whole row and press the Delete key on the keyboard.
When several attribute filters are defined it is possible to decide if all of them should meet the rule for a specified shape or if it is enough that one of them is valid for a given shape. This depends on the state of the Require all the following check box.
If the selection criteria type is set to ‘PML expression’ then there will be a text box displayed to key in the expression. It will be executed on all database elements represented on the drawing and the element will be considered as satisfying the rule criteria if the expression returns True. Therefore the expression must be of boolean type, e.g. FUNC EQ ‘PIPE’. For more information about constructing PML expression see User Guide Software Customization / Customization Guide / PML Expressions.

Defining selection criteria using the PML expression option
The third possible Criteria is ‘Shapes without DB element’. After this is selected from the drop down, user is able to decide which shapes not having any connection should be taken into account. There is an option to select:
-
Not defined shapes
-
Shapes defined but not having any DB representation (this could happen e.g. when element is deleted from database from command line)
-
Non-database shapes like Labels, Title blocks, Instrument Relationship Shapes etc.

Defining selection criteria for shapes without DB representation
Apart from specifying the database condition, it is also possible to set Visio formula as an additional shape condition. To set the formula 'Visio shape condition...' link label should be pressed and a valid Visio formula should be shown in the dialog:

Setting Visio shape condition
Following Visio standards, the formula should be of Boolean type and result in TRUE (non zero) or FALSE (zero). The entered formula will be executed on shapes and is allowing to make applying rules dependant of e.g. shape geometry. For example formula (BeginXEndX)*(BeginX-EndX)+(BeginY-EndY)*(BeginY-EndY)>10mm could be used if the rule should be applied to shapes matching the given database criteria and in addition only if the length of the connector is greater than 10 mm.
After the selection criteria are defined it is possible to check to which shapes the rule will be applied on the current drawing using the Highlight link placed at the right bottom of the dialog. After this is clicked all shapes meeting the criteria will be highlighted on the current drawing.