Basic Customization > User Interface Customization > Presenting Information in the UI > Attribute Customization > Windchill Attribute Customization Overview > Common Attribute Customization Procedures > Validating Input Values, Legal Value Lists and Cascading Attributes
  
Validating Input Values, Legal Value Lists and Cascading Attributes
You want to restrict the values allowed for an attribute.
Solution Elements
Element
Description
Legal value list Constraint
A constraint defined in the Type and Attribute Management utility. See Attribute Constraint Rules for more information.
Enumerated list Constraint
A constraint defined in the Type and Attribute Management utility. See Attribute Constraint Rules for more information.
EnumeratedType in Modeled class definitions
See the “GenAsEnueratedType columns” section in Specialized Persistence Constructs for more information.
Cascading Attributes
Dependencies between attributes defined in the Type and Attribute Management utility. See Cascading Attributes Tab.
Valid Range Constraint
A constraint defined in the Type and Attribute Management utility. See Attribute Constraint Rules for more information.
upperLimit, lowerLimit Constraints
A constraint defined when defining the modeled class. See Modeling Business Objects for more information on PropertyConstraints. Same functionality as the range constraint when used with Numeric attributes.
Wildcard Constraint
A constraint defined in the Type and Attribute Management utility. See Attribute Constraint Rules for more information.
Regular expression constraint
A constraint defined in the Type and Attribute Management utility. See Attribute Constraint Rules for more information.
String format constraint
A constraint defined in the Type and Attribute Management utility. SeeAttribute Constraint Rules for more information.
No Duplicate Values constraint
A constraint defined in the Type and Attribute Management utility. SeeAttribute Constraint Rules for more information.
Selection List Style
A property to specify how the legal values should be displayed in the UI. See “Select List Style” in Configuration Points for more information.
Include Blank Option
A property to specify whether to include a blank option in the legal value list . See “Include Blank Option” in Configuration Points for more information.
Intended Outcome
You are able to do one or more of the following:
Restrict the input by specifying a set of valid values that the user needs to pick from.
Example:
When Include Blank Option is set to true
When Include Blank Option is set to false
Allow the value of one attribute to define the value of another attribute, where both attributes have sets of valid values defined.
Restrict user input to be within a certain range and display a validation message when the value is outside the range(s).
Ensure that the user input for a String attribute conforms to a given pattern of characters. Display a validation message when the value entered does not conform to the pattern specified in the constraint.
Require that user input values be unique.
Solution
The combinations of the solution elements required to achieve the different kinds of behavior are listed below:
If you want to…..
Configuration
Display a Dropdown list (also configurable as a group of radio buttons) with the set of legal values for the attribute; do not allow the user to type in a value.
For global and local attributes, use:
Legal value list for non-localized lists
Enumerated list for localized lists.
For modeled attributes, use:
EnumeratedType in Modeled class definitions.
To define a legal value list on an existing modeled attribute without having the need to recompile, use the Legal Value list constraint (localized list) or the Enumerated list constraint(non-localized list) in the Type and Attribute Management utility.
Allow the user to type in a value, but restrict the value to be within a given range.
For modeled attributes, use upper limit, lower limit constraints.
For local and global attributes, use the Range constraint.
Allow the user to type in a value, but define more than one range for validating the value.
Significant figures constraint
This is applicable only to Real Numbers and Real Numbers with Units.
Allow the value of one attribute to define the value of another attribute.
Use Cascading Attributes Tab in the Type and Attribute Management utility.
You want to limit the value entered by the user to conform to a given pattern.
Use the wildcard constraint, the regular expression constraint or the string format constraint
You want to require the set of values entered for a single business object to be unique.
Use the No Duplicate Values constraint.
Specify how the legal values should be displayed in the UI
Use the property Selection List Style.
Provide a blank option to clear the current value of the attribute, when using legal value lists.
Use the property Include Blank Option.
Combining legal value lists, valid range constraint significant and figures constraint
It is possible to have more than one of these configurations defined for an attribute. The following table shows the effect of combining these configurations:
Constraints specified in Type and Attribute Management utility for an attribute
UI behavior
Legal value list(s) + Enumerated list(s) + Enumerated type
The list displayed will be an intersection of all the constraints i.e. the list will have entries that are common to all the defined lists.
Example:
Given the following constraints:
1. Enumeration:
COLOR_RED = Red
COLOR_BLUE = Blue
COLOR_GREEN=Green
2. Non-localized legal value list:
COLOR_RED
COLOR_BLUE
3. Non-localized legal value list:
Red
Blue
 
If the user were to apply 1 and 2, the resulting legal values should be:
COLOR_RED = Red
COLOR_BLUE = Blue
 
If the user were to apply 1 and 3, the result would be an empty set (no legal values).
When all the legal value lists specified for an attribute are combined, the resulting list will be an intersection of all the lists (i.e. only those entries that are common to all the lists will be added to the resulting list). So it is possible to end up with an empty legal values list when multiple legal value lists have been defined. When the legal value list is empty, the end-user UI displays an input field.
Legal value list + Range constraint
Drop down populated with only those values in the legal value list that satisfy the range constraint. (configurable as a group of radio buttons). No tool-tip message.
Legal value list + Significant figures constraint
Drop down populated with only those values in the legal value list that satisfy the range derived from the significant figures constraint. (configurable as a group of radio buttons). No tool-tip message.
Range constraint + Significant figures constraint
Input field with tool-tip indicating the valid range(s). Validation message will indicate the valid range(s).
The valid range(s) will be the range(s) derived from the intersection of these 2 constraints.
Legal value list + Range constraint + Significant figures constraint
Drop down populated with only those values in the discrete set that satisfy both the range(s) of the “Range constraint” and the range(s) of the “Significant figures” constraint. No tool-tip message.