<!-- processing instructions -->
You can include multiple EXECUTE statements within a PIPELINE, COMPONENT, INFORMATION, MATERIAL, or JOINT element. The GED function evaluates each EXECUTE statement separately. If a Criteria expression is present, the evaluation is conditional on the criteria expression being True.
A Criteria expression consists of a mixture of macros and VBScript statements and functions. For example, the following EXECUTE statement is evaluated only at pipe components:
<EXECUTE Criteria = "'$M.ComponentType$' = 'Pipe'">
The macro $M.ComponentType$ is evaluated at the current item, and the value of the ComponentType attribute is inserted. At a flange, the expression evaluates as:
'Flange' = 'Pipe'
Because this is False, the commands within the EXECUTE statement are not evaluated.
The following EXECUTE statement is only evaluated if the component ItemCode attribute contains the string ABC and the component is a weld neck flange.
<EXECUTE Criteria = "Instr(1,'$M.ItemCode$','ABC')>0 AND '$M.ComponentType$' = 'Flange-Weld-Neck'">
The function Instr is a standard VBScript function and returns a value greater than zero if the second string (ABC) is found in the first string (the ItemCode of the current component).
You can find documentation and other background information on VBScript at the Microsoft web site.
An EXECUTE statement with no Criteria expression is always executed.
Use of a Criteria expression is much more efficient when an SQL statement is being evaluated at each component in the POD. This is because the Criteria expression ensures that the SQL statement is only executed at relevant components. In a pipeline with several hundred components, of which only a few are of interest, this can be significant.