You are here: Reference > Rule types > Constraints > More about Constraints rules

More about Constraints rules
 

  1. About 
  2. New 
  3. Constraints 
  4. Pages & Classes 
  5. History 
  6. More... 

Conflicting constraints

Multiple constraints that are impossible to meet are neither detected or rejected, such as A > B and B > A. Both properties are marked as not valid each time either is changed.

Primary page

During execution of a constraints rule, the page on which the rule operates temporarily becomes the primary page. The page keyword PRIMARY and the results of the tools.getPrimaryPage() PublicAPI method reflect this change. When the constraints rule completes, the primary page of the calling activity resumes as primary.

Alias Function rules

The contents of the selection lists on the Constraints tab depend on property alias rules and alias function rules.

Change tracking exceptions

The constraints are tested when a property value on the primary page (the page that matches the Applies To key part of the rule) changes. The following do not cause the constraints to be evaluated:

Workstation display of constraint failures

When appropriate, your application can display constraint rule violations immediately as a user changes an input value on a user form or flow action form, rather than later when the form is submitted. The user can see the constraint message immediately.

For example, the constraint may require that the Due Date field be at least a week after the Start Date field. As a user enters and revises work item data, the constraint is checked immediately as user focus leaves either input field.

This feature can improve user productivity and accuracy, while also reducing the number of server interactions and HTTP traffic required to complete a valid input form. Consider whether and where such interactive checking may simplify the user's task of completing complex input forms in your application.

To implement this capability:

  1. For best results, use this feature on flow actions or harnesses that use the SmartFrames layout and JSP tags rather than declaratives.
  2. Include the properties involved in the constraints on the same flow action form, or on the same user form (in the same or different sections). (Don't place the input in the flow action form and the target in the harness form or vice versa.)
  3. Select the Enable Expression Calculation? box on the HTML tab of the Flow Action form or Harness form.
  4. Test.

This feature is based on AJAX technology.

Viewing the Java code of a rule

Click Actions > View Java to view the generated Java of a rule. You can use the Java code to debug your application or to examine how rules are implemented.

Testing and debugging constraints rules

Using the Tracer, you can watch the evaluation of a constraints rule. Start the Tracer and select a requestor session. Click the Options button (Options) and check the Declare Constraint box in the Event Types to Trace section. Also check the RuleSet that contains the rule to be traced.

The statistic Tracked Property Changes on the full details page of the Performance tool shows how many property changes have occurred (for the current requestor since log-in) that are tracked for declarative rules computations. You can modify the prlogging.xml file to log additional details about tracked property changes. See PDN article How to determine which properties are tracked for declarative processing.

OnChange activities

Constraints rules, like Declare Expression rules, do not evaluate during the execution of an OnChange activity.