Back ForwardHarness, Section, and Flow Action forms
Adding a Dynamic Select control to a field

About Harness rules

Show all 

You can associate a Dynamic Select control with a field on a work object form or flow action form. You can create cascading Dynamic Select controls, so that the choices that users see at runtime for a second field are determined by their earlier selection in a previous field. C-2580 OSMAE 5.2

In most cases, you do not need to code XML or HTML. For advanced cases and to aid in testing Dynamic Select controls, see Dynamic Select — Internal operations and advanced features.

  Definition

Dynamic Select exampleA Dynamic Select control is an optional feature you can add to work object forms (through HTML rules, harness rules, or section rules) and other HTML forms to speed user input. The user chooses from one list, computed on demand, to determine a (possibly distinct) value to assign to the property. For example, a user may choose a school course name "Introduction to Computers" from a list that shows only courses with unfilled enrollment. Reflecting the user's choice, the Dynamic Select control may assign a corresponding value such as COMP101 to the property.

TipDon't use a Dynamic Select control if the options for the drop-down list are stable and the list will be short. Consider providing the values on the General tab of the Property rule:

  1. Set the Property Mode to Single Value.
  2. Set the Property Type to Text.
  3. Set the Table Type to Local List. A Table Values form appears. Enter the values for the drop-down list.

Don't use a Dynamic Select control if an ordinary HTML Select box meets the need. See Harness, Section, and Flow Action forms — Adding A Select control.

 1. Preparations: Using a list view rule

Use this procedure when the values that users select and the values for the property are both present as columns in a list view rule.

Find or create a list view rule. Enter ALL as the Owner key part.

1. In the Show These Fields area of the Display Fields tab, identify two properties. Identify a property for the report column that is to contain the possible values of the property. Identify a second property as the source of text values to appear in the drop-down list. (If the displayed values are the same as the internal property values, include the property only once.)

TipThe Dynamic Select feature provides best performance when these two properties that are exposed as columns in the PegaRULES database table that supports the class. If they are not now exposed, update the database schema to expose them if feasible. This is important if the Dynamic Select control is to be used with high frequency. ZELEK 11/14/06

2. Complete the selection criteria, sorting, and other fields on the List View form. Don't enable report paging, as the Dynamic Select drop-down list then shows only items on the first page. OSMAE 11/2/06

3. Save and test the new list view rule.

NoteOften, values for the Dynamic Select control are instances of a class that users maintain with the Data Table editor. If so, you can use either of two standard list view rules:

 2. Preparations: Using an activity

In some cases, your application can't present the needed data using only a list view rule. For example, some data values may be contained in an external system, accessed through a connector. You can create an activity that produces the XML document needed by the Dynamic Select control.

Find or create an activity that produces as output a top-level clipboard page. In simple cases, if the class containing the instances to be listed is derived from the Data- base class, you may use the standard activity Data-.GetClassInstances. The structure of the clipboard page produced by the activity must be similar to that produced by the Obj-Browse method, though you can produce it by any means:

As the final step of the activity, use the Show-Page method to convert this page to an XML document. Check the May Start? option on the Security tab of the Activity form.

 3. Drag and drop the Dynamic Select control

Click the down-arrow (Arrow) at the right end of the Advanced control group (Properties) and select the Dynamic Select control (Dynamic Select). Drag the control to the cell or header that is to contain the property value. When the pointer changes shape to indicate that a single cell is selected, release the mouse button to drop the control.

If the cell is not empty, the dropped control replaces the current contents of the cell. Click the magnifying glass (Magnifying glass)to display the Cell Properties panel.

 4. Complete the Cell Properties panel — Top fields

Complete top fields of the Cell Properties panel. GRP-229

Your updates to this panel can update the rule form immediately or upon clicking Apply, depending on the Property Panel settings in your Edit preferences. See Setting your preferences. If the panel is pinned(pin), the wireframe on the rule form changes immediately to reflect your inputs. If the panel is not pinned(pin), click Apply to apply your inputs.GRP-229

Field

Description

Property

SmartPromptSelect or type a property reference that identifies a single text value that has a dynamic set of possible values. SR-4597 B-22011 Single Value only? (Use the default placeholder property @baseclass.pyTemplateDynamicSelect only when prototyping work object forms and the actual property is not yet defined.)

Click the pencil icon (Pencil) to review the property rule (if the reference is to an existing property in the Applies To class of this rule or a parent of that class). If the property is not found, the New dialog box for the property form appears.

You can reference properties on any page identified on the Pages & Classes tab, using the normal notation pagename.propertyname for pages other than the page corresponding to the Applies To class of the rule.

Control

SmartPrompt Accept the supplied value DynamicSelect. Click the magnifying glass icon (magnifying glass) to enter parameters.

Parameter Description
Method for Generating Dynamic Select

Select a radio button to indicate which of three runtime approaches is to be used to derive the contents of the list. The form changes to reflect your selection.

List View Information

Complete these fields if you selected the List View radio button.

Applies To

Enter the first key part of the list view rule.

View Purpose

Enter the second key part — Purpose — of the list view rule. At runtime, the system uses these two key parts and rule resolution to locate the list view rule to run.

Activity Information

Complete these fields if you selected the Activity radio button.

Applies To SmartPromptSelect the first key part of an activity rule.
Activity Name

SmartPromptSelect the second key part of an activity rule. If the activity requires as an input parameter the value of a property controlled by another Dynamic Select control, you can identify this parameter and its source in the Filter fields.

If the activity requires other input parameters, use the Advanced radio button to enter them in URL format.

Class of Returned Results

SmartPromptOptional. Identify the class of the pxResults() pages. (This helps during development, by facilitating SmartPrompt operations.)

Advanced

Additional fields appear if you select the Advanced radio button. See Advanced Format Parameters.

Common Dynamic Select Information

These fields apply to every Dynamic Select control, regardless of which approach you use to build it.

Select ID

Optional. Enter an alphabetic-only value for the ID=" " element in the <SELECT> control. The ID is required when you need to reference this control in another Dynamic Select control.

Default Caption

Optional. Enter a text value for the caption value in the control. For example, "Choose a state".

Property for Option Display

SmartPromptIdentify the property that supplies the text values displayed to users at runtime.

Property for Option Value

SmartPromptIdentify the property that is the source of internal values for the field on the Harness, Section, or Flow Action form. This property may be the same as the property in the Property for Option Display field.

Enable Cache

When set to true, Dynamic Select instructs the user browser to cache the data that it receives for a specific URL. The next time the data is needed (for the exact URL from this user), the activity is not called and the cached information is presented again. B-22531 SR-5488 The default is true, which is recommended.

This feature is especially useful when a single HTML form includes more than one Dynamic Select control that have a common value for the Source. For example, a user may need to select one or more General Ledger codes for debits, and later one or more General Ledger codes for credits.

Filter

Optional. Complete these parameters to filter the results in this Dynamic Select control based on the value at runtime of another Dynamic Select control on the same work object form that users typically complete first.

Enter one row if the values to be presented depend on the value selected by users on a single previously completed field controlled by a Dynamic Select control. Enter multiple rows if multiple selections affect the choices to be presented by this row.

The SelectID of Dynamic Select control identified in the last row becomes the ParentID for this Dynamic Select control. As a result, the system refreshes the contents of this Dynamic Select only when the value changes in the parent control, not when any other Dynamic Selects control lists change. If your application requires this Dynamic Select control to refresh when a value changes for any of multiple parents, use the TargetID option in the Advanced format for the parent Dynamic Select controls.

Field

Description

Param Name ArrayOptional. Enter the name of an input parameter to the activity identified in the Activity Name field, or a parameter affecting the list view rule identified in the View Purpose field. Do not prefix the parameter name with "param:".
Select ID Optional. Enter the ID field of the other Dynamic Select control that at runtime has a value for the parameter.
Behavior

Optional. Leave blank if no dynamic form actions to other parts of the form are to occur based on user updates or values for this field. C-1990

To establish a dynamic form action, click the magnifying glass icon (Magnifying glass) to open the Client Event Editor in a new dialog window. Complete the Client Event Editor to select an event (OnBlur, OnChange, or OnClick) and the resulting form action. C-2526

Click the help icon ( Help) on the Client Event Editor for assistance. For general information on this capability, see Implementing dynamic form actions and the Client Event Editor.

Event support is available for harness, section, or flow action rules that have Generate for set to JSP on the HTML tab and that use the SmartFrames layout.

 5. Complete the Cell properties panel — General tab

The General tab for a Dynamic Select control is identical to the General tab for an Input Box control. See Completing the Layout tab — Adding an Input Box — General tab.

 6. Complete the Cell Properties panel — Advanced tab

The Advanced tab for a Dynamic Select control is identical to the Advanced tab for an Input Box control. See Completing the Layout tab — Adding an Input Box — Advanced tab.

 Advanced Format parameters

Advanced featureUse the advanced approach described in this section when you require additional control over the function and appearance of a Dynamic Select control and are familiar with URL encoding.

1. Find or create an activity that produces a XML document, structured to match the XML document that corresponds to a clipboard page of class Code-Pega-List.

2. Select the Advanced radio button. Complete these fields.

Field

Description

SelectID

Optional. Enter an alphabetic-only value for the ID=" " element in the <SELECT> control. An ID is needed when another Dynamic Select controls is a parent to this control and supplies a filter value.

Source

Enter the query string form of the activity to call, including values for parameters. Click the magnifying class button (Magnifying glass) to open an Activity Picker window for guidance on entering input parameter values. Use URL encoding (commonly called percent-encoding) for blanks and other special characters. Use this syntax:

pyActivity=myClass.myActivity&param=value....

You can reference another HTML element (such as a parent Dynamic Select control) for a parameter value. Enclose the ID of the other element between square brackets. For example, to reference an element with ID=textbox17:

pyActivity=ActivityClass.ActivityName
           &param1=false
           &param2=[textBox17]

Set Primary Page

Select No in most cases. Select Yes in a rare case when your application requires the primary page of the current activity at runtime — typically a page containing a work object — to become the primary page of the activity referenced in the Source field.

Caption

Enter a semicolon-delimited string of property names that form the visible text of Option elements, in the format: B-19276 SR-2303

propertyName1;propertyName2;...

For example. to display the name and the label of a class as the text of the Dynamic Select options elements, use the following:

pyClassName;pyLabel

Value

Enter a semicolon-delimited string of property names that form the values of the HTML Option elements in the format:

propertyName1;propertyName2;...

For example, the following string sets the values of a Dynamic Select to the class names in a list:

pyClassName

Default

Optional. Enter a text value that becomes the runtime default value of the Dynamic Select control.

DefaultCaption

Optional. Enter a text value for the caption value in the control. For example, "Choose a state".

ParentID

Optional. Enter the ID of another <SELECT > element that, when changed, triggers a refresh of this control.

TargetID

Optional. Complete this field when the results of another Dynamic Select control on the same harness, section, or HTML form depends on the results selected by users for this Dynamic Select control. This technique is known as cascading. SR-4149 B-21493SR-5424 B-24062

Enter one or more semicolon-delimited text value to identify the ID(s) of the other Dynamic Select controls whose values depend on the value selected in this Dynamic Select control.  When a user selects a value in this Dynamic Select control, the system appends the value to the Source of the target Dynamic Select control. The activity of the latter control is then executed to populate it.  The Source of the target control must end with the following syntax:

parameterName=.

The value of the selected option in the first Dynamic Select then becomes the value of the parameter in the activity of the target Dynamic Select.

NoDataCaption

Optional. Enter text that appears when the activity returns an empty page. If this field is blank, the default text "No results were found." appears.

Delimiter

Optional. Enter one or a few characters to override the default delimiter used to concatenate multiple captions or values. If this field is blank, the delimiter is a single space character.

LoadMode

Select:

  • Auto — The system loads the Dynamic Select control when the HTML page is assembled for the user. SR-3663 B-20659 (You can't also specify a Default value when you choose this.)
  • Dynamic — The system loads the Dynamic Select control only on request because it depends on another Dynamic Select control.
  • OnDemand — The system loads Dynamic Select control on request, when the mouse pointer hovers over the control or the control receives focus. This feature is known as deferred loading, as the activity runs only after a user explicitly requests the output. C-177
OnDemandCaption

Optional. Enter an optional string to appear as the caption of the default value when this Dynamic Select control is set to OnDemand mode. The value of this attribute can be:

  • A literal string.
  • A reference to an HTML element. Enclose the ID of the element in square brackets.
  • An activity call that returns the text of the caption.

To call an activity, use the following syntax, using URL percent encoding for special characters:

pyActivity=myClass.myActivity&param=value....

WaitTime

Optional. Enter a value between 1 and 60 to set a maximum period in seconds after which processing times out (fail) if no results were received from the activity.

If omitted, the default timeout value is 3 seconds. The system does not notify users of this timeout.

EnableCache

When set to true, the Dynamic Select control instructs the user browser to cache the data that it receives for a specific URL. The next time the same user accesses this control, cached information in the browser cache appears again; the system does not call the activity. B-22531 SR-5488

The default is true, which is recommended for best performance.

This feature is especially useful when a single HTML form includes more than one Dynamic Select controls that have a common value for the Source. For example, a user may need to select one or more General Ledger codes for debits, and later one or more General Ledger codes for credits.

Width

Optional. Enter a width in pixels of the drop-down area BUG-12691 3/10/08 NATAA

ReadOnlySmartInfo

Optional. Select a section that presents at runtime a SmartInfo pop-up display when this field appears in read-only mode.

ReadWriteSmartInfo

Optional. Select a section that presents at runtime a SmartInfo pop-up display when this field appears in read-write mode.

SmartInfoHeader

Optional. Enter a text string to appear at runtime as the contents of the SmartInfo header.

Size

Optional. Enter a count of the number of drop-down rows presented. BUG-12691

 Testing notes

When testing, clear the browser cache on your workstation frequently. (For Internet Explorer, select Tools > Internet Options > General > Delete Files).

Alternatively, click the Advanced radio button on this form and temporarily set the Enable Cache setting to false. After you complete testing, set the Enable Cache setting to true. ZELEK 11/14/06

 Related PDN articles

See the Pega Developer Network article PDNPRKB-25898 How to configure cascading dynamic select controls.

Up About Flow Action rules
Up About Harness rules
Up About Section rules