Configuring Expressions
Mapping Operators Used In Expressions
You can map the characters used for logical operators that appear in the user interface to the internal characters for logical operators ("&&", "||", "!") that are stored in the database.
To specify custom logical operators in expressions, set the following values in the properties WT_HOME\codebase\wt.properties file:
• ato.conjunction.operator
• ato.disjunction.operator
• ato.negation.operator
The Load file uses AND (logical AND), OR (logical OR), and ! (Logical NOT) operators for loading expressions and is not configurable.
Out-of-the box values are:
• For AND: ato.conjunction.operator=+
• For OR: ato.disjunction.operator=/
• For NOT: ato.negation.operator= -
You can specify your own values for AND, OR, or NOT by providing your own symbols after “=”. When defining expressions, these symbols are used to denote the conjunction (logical AND), the disjunction (logical OR), and the negation (logical NOT) operators. For example:
-red + -(green / white / -blue)
Using the Expression Converter To Support Site-specific Formats
Sites can customize the format for entering and displaying expressions using an expression converter available with Windchill.
To specify a custom expression format converter:
1. Create a class implementing com.ptc.wpcfg.logic.ExpressionFormatConverter that defines the following three methods:
◦ Method for converting the subexpression from custom to out-of-the-box
public String toInternalSubexpressionFormat(String externalSubexpressionString)
The argument externalSubexpressionString represents a subexpression string in an external (custom) format used when entering expressions in the expression definition user interface. The custom format is used when assigning expressions to part usage links and parts, and when specifying expressions for a conditional rule.
The method returns a subexpression string in an internal out-of-the-box format where the operands are choice names if they represent valid Java identifiers, and quoted choice names if they are not valid Java identifiers. The logical conjunction AND, disjunction OR, and negation NOT operators must conform to the definitions specified in ato.conjunction.operator, ato.disjunction.operator, and ato.negation.operator properties in the wt.properties file, respectively. The out-of-the-box values are: “+” for the conjunction, “/” for the disjunction, and “-“ for the negation operators.
◦ Methods for converting the subexpression from out-of-the-box to custom
public String toExternalSubexpressionFormat(String internalSubexpressionString)
The argument internalSubexpressionString represents a subexpression string in an internal out-of-the-box format. The method returns the subexpression String in the external (custom format). This format is used in the expression definition user interface.
◦ Method for the custom display of expressions
public String toExternalExpressionFormat (String [] internalSubexpressionStrings)
The argument internalSubexpressionStrings is an array of subexpression strings in internal out-of-the-box format in the same order as in the expression definition user interface. The method returns the entire expression String in the external (custom) format. This format will be used when displaying the expression in the assigned expression columns in the product structure browser, in the rule definition columns in various conditional rule tables, and in the conditional rule information pages. In the implementation of this method, you can use the toExternalSubexpressionFormat(String) method to convert subexpressions into the custom format.
2. Register the full path to the expression converter class under the property ato.expression.converter in the wt.properties file. For example:
ato.expression.converter=ext.customer.expr.format.CustomExpressionFormatConverter.