You are here: User interface > User interface rules > Harness and section forms > Harness and Section forms - Adding a Dynamic Select control

Harness and Section forms - Adding a Dynamic Select control

Caution: The Dynamic Select control is deprecated. Use the Dropdown control (pxDropdown), which replaces the Select in the Basic control group, instead. The drop-down control is easier to configure and includes additional features. See Harness and Section forms — Adding a Dropdown control.

As a best practice, upgrade Dynamic Select controls to drop-down controls. If a section contains DynamicSelect, Select, or another control for which there is an improved alternative, a warning displays, along with an Update Controls button. Click Update Controls to automatically update deprecated controls in the section. Automatic update is not available for all controls; see Upgrading deprecated and outdated controls on the PDN.

Definition

A Dynamic Select control is an optional feature that you can add to user forms (through flow actions, harnesses, or sections) 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 might choose the course "Introduction to Computers" from a list that shows only courses with unfilled enrollment. Reflecting the user's choice, the Dynamic Select control might assign a corresponding value such as COMP101 to the property.

Do not use a Dynamic Select control if the options for the drop-down list are stable and the list is 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.

Do not use a Dynamic Select control if an ordinary (that is, static) HTML Select box meets the need. See Harness and Section forms — Adding a Select control.

1. Preparations: Using a report definition

Use this procedure when the values that users select and the values for the property are both columns in a report definition.

Find or create a report definition and specify the following information:

  1. In the Columns To Include area of the Design tab, identify two columns that specify the two properties for the Dynamic Select feature:
  2. Complete the rest of the fields on the Report Definition form. Do not enable report paging, because then the Dynamic Select drop-down list shows only items on the first page.
  3. Save and test your changes.

2. Preparations: Using a clipboard page

Use this procedure when the values that users select and the values for the property are both present on a clipboard page.

Determine the name of the clipboard page (a Page List or class Code-Pega-List) that is to be located at run time for the source of the properties. For example: when the flow action or user form appears, is that clipboard page already present with the appropriate data for this Dynamic Select? Or do you need to build an activity to construct the clipboard page to ensure it is present at the right point in the process at run time?

3. Preparations: Using an activity

In some cases, your application cannot present the needed data by using only a report definition or clipboard page. For example, some data values might be in an external system and 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.

4. Drag and drop the Dynamic Select control

From the Advanced control group, select the Dynamic Select control. 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 View propertiesicon to display the Cell Properties panel.

5. Complete the Cell Properties panel — Top fields

Complete top fields of the Cell Properties panel.

Your updates to this panel update the rule form upon clicking Apply. 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.

Field

Description

Property

Select or type a property reference that identifies a single text value that has a dynamic set of possible values. (Use the default placeholder property @baseclass.pyTemplateDynamicSelect only when prototyping user forms and the actual property is not yet defined.)

Click the Open icon to review the property (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

Accept the supplied value DynamicSelect. Click the View propertiesicon to enter parameters.

Parameter Description
Method for Generating Dynamic Select

Select a radio button to indicate which of the run-time approaches is to be used to derive the contents of the list. The parameter form changes to reflect your selection.

   
Report Definition Information

Complete these fields if you selected the Report Definition radio button.

Applies To

Select the first key part of a report definition.

Report Name

Select the second key part — Report Name — of the report definition. At run time, the system uses these two key parts and rule resolution to locate the report definition to run.

Clipboard Page Information

Complete these fields if you selected the Clipboard Page radio button.

Clipboard Page

Specify the clipboard page (a Page List or class Code-Pega-List) that will be available on the clipboard at run time.

Class of Returned Results

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

Activity Information

Complete these fields if you selected the Activity radio button.

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

Select the second key part of an activity. 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

Optional. 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

Identify the property that supplies the text values displayed to users at run time.

Property for Option Value

Identify 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. 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 run time of another Dynamic Select control on the same user 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 Optional. Enter the name of an input parameter to the activity identified in the Activity Name field. Do not prefix the parameter name with "param:".
Select ID Optional. Enter the ID field of the other Dynamic Select control that at run time 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.

To establish a dynamic form action, click the Gear icon 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.

Click the Help icon on the Client Event Editor for assistance. For general information on this capability, see Harness and Section forms Help — Client Event Editor.

Event support is available for harnesses, sections, or flow actions that have Generate for set to JSP on the HTML tab and that use the SmartFrames layout.

6. Complete the Cell properties panel — General tab

The General tab for a Dynamic Select control is identical to the General tab for a Text Input control. See Adding a Text Input control — General tab.

7. Complete the Cell Properties panel — Advanced tab

The Advanced tab for a Dynamic Select control is identical to the Advanced tab for a Text Input control. See Adding a Text Input control — Advanced tab.

Advanced Format parameters

Use 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 Gear icon 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]

You can pass property values as parameters to the document by including them within square brackets in the Activity picker window. For example, here the activity requires a parameter numRecords and the value that is passed in stored in Property recordParam.

pyActivity=ActivityClass.ActivityName
&numRecords=[recordParam]

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 run time — typically a page containing a work item — 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:

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 run-time 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.

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 is assembled for the user. (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.
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.

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

ReadOnlySmartInfo

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

ReadWriteSmartInfo

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

SmartInfoHeader

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

Size

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

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.