Harness and Section forms —
|
User interface events such as entering a property value in an input box or selecting a value from a Dynamic Select field can automatically trigger UI actions such as refreshing a harness, a section, hiding a property or section, expanding a layout, and so on. Changes on the server or the clipboard, for example, through a declarative expression or data transform, can also update the UI.
These actions make dynamic, interactive user forms and can improve user productivity and accuracy.
Use the Condition Builder to specify when rules and expressions that define the conditions that must be met before a UI action is triggered. This topic describes how to set conditions using the When condition fields: Visible When, Refresh When, and Read Only When.
For information on setting behaviors and actions for controls, see Control Form — Completing the Control tab.
You control the conditions that trigger UI actions using When condition fields such as Visible When, Refresh When, and Read Only When, which are located on many UI element properties panels. You can enter:
AddDelete
or Changes
as Refresh When conditions. These keywords cause a section refresh based upon a change to a property value. The Condition Builder provides an easy-to-use editing tool for defining conditions and helps ensure that expressions are valid. You access the Condition Builder by clicking next to a When condition field.
When condition fields are located on interface element property panels, which contain these When condition fields:
Property Panel | Condition |
Cell | - Visible When - Read Only Condition |
Layout | - Visible When - Expand When - Column, Row, or Body Visible When ( column, row, or tab repeat layouts, respectively) See: |
Included or Referenced section | - Visible When - Refresh When - Expand When - Active When - Body Visible When - Read Only When See Adding a section |
Harness Container | - Visible When - Expanded When (Collapsible and Tabbed header types) |
Harness Panel | - Visible When - Refresh When |
Control rule (parameter) | - Disabled Condition See About Controls |
Note: Do not confuse When condition fields (such as Refresh When or Visible When) in property panels for UI components with when condition rules.
Without conditions, the default behaviors are as follows:
To access the Condition Builder, do the following:
Other Condition
next to the Visible field. This displays the Condition field.This section describes how to build conditions for most when conditions. Refresh When conditions are described in the following section in this topic.
In the first drop-down list, choose the type of condition. Select When
if you want to use a when condition rule, or select Expression
if you want to use an expression.
When condition rule
Enter a when condition rule.
When
drop-down, enter the When Name key part of a when condition rule. The system uses the Applies To key part of the current rule in rule resolution to locate the when condition rule. Click the Open icon to review or create the rule.Is True
or Is False
from the drop-down list.And
or Or
if you wish to add another test condition (a when condition rule or an expression).Expression
Configure an expression based on the comparison of a pair of constants, properties, or both, combined by Boolean operators.
Expression
drop-down, use the property fields and the operator drop-down list to configure an expression.Red=.color
is valid..PageList(1).Property1 > 20
.PageGroup(“a”).Property1 > 20
.Page1.Property1 = 200
.PageList1(1).Property1 = “test”
Page1.PageGroup(“a”).PageList(1).Property1 = “test”
Date
or DateTime
type in a comparison. Function references are not supported.And
or Or
if you wish to add another test condition (a when rule or an expression). If you use both conditions, the system inserts the && and || operators to denote your selection.Click OK when you have completed the form. The expression appears in the When condition field on the Property panel.
The Run on Client? check box appears beneath the When condition field if the expression can be run on the client. Complex expressions and When rules are not eligible.
Select this check box if you want to cause evaluation and execution of the condition each time the value of a property stated in the condition changes. When the expression processes, all possible layouts are sent to the browser. Only the layout that matches the criteria is shown; any others are hidden. This enables you to switch layouts without a refresh.
This option is not recommended if there are many conditionalized elements or the layout requires significant processing. For example, if you have four different versions of a grid that can appear at different times, you would not want to populate and generate all four, in order to render the page for the one that is visible.
If the Run on Client? check box is not selected, then the expression is evaluated and the condition is dynamically executed when the form is initially presented and whenever the form is refreshed. Only the layout that matches the criteria is sent to the browser.
Run on server — Expressions must be run on the server if they contain:
— A when condition rule.
— Contains property and constant combined by boolean operators. Using a boolean property limits the options available for an expression.
Run on client — Expressions may be run on the client if:
— A when condition rule is not referenced.
And
— The expression has 4 or fewer properties and constants.
Example:
.pyProp2=“blue”&&.pyProp2>.pyProp3
See Constants in expressions — Constants for information on entering constants.
To invoke this processing, select Run On Client on the Properties panel.
Refresh When conditions are expressions (see above) that can leverage the Changes
or AddDelete
keywords. To use the keywords:
Changes
— Refreshes the section when a property value located anywhere on the harness changes. Select this option from the drop-down list and select a property. Optionally, use an OR condition with another AddDelete
or Changes
keyword.
AddDelete
— Triggers an event when a row or column is added or removed from a repeating layout within the section ( Refresh When .pagelist() AddDelete). For example, an Order Summary that updates when the user edits the list of items in a shopping cart. Select this option from the drop-down list and select a Page List
property. Optionally, use an OR condition with another AddDelete
or Changes
keyword.
Combining keywords with expressions
You can combine keywords with expressions using AND/OR conditions. For instance, you can specify that a property changes only when a check box is checked ( .Property1 Changes
AND .Property2 = True
). Other examples include:
.Property1 Changes
AND.Property2 = "aaa"
.List1(). Property1 Changes
OR.Property2 . List1()
.List2() AddDelete
AND.List(2).PageGroup(Operator).name = "Scott"
Available for Refresh When conditions.
Activity — Enter an activity with the Activity Name key part of an activity that may affect the content of the section to be redrawn.
Data Transform — Enter a data transform with the Name key part of a data transform that may affect the content of the section to be redrawn. See About Data Transforms.
To find the activity or data transform at runtime, rule resolution uses the Applies To class of these rules.
If used in combination, the system processes the data transform first.
If you are building a non-auto-generated control that can trigger a UI event, note the following prerequisites:
To implement a Refresh When condition, the Pega 7 Platform uses AJAX technology to communicate between the browser client and the server at runtime.
AJAXHarness and Section forms | |
— Fields — Adding a Text box |