Harness and Section forms - Adding a Dynamic Select control |
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 Dropdown 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.
If you want to populate data in a drop-down control from a List View, use the Dynamic Select control. For advanced cases and to aid in testing Dynamic Select controls, see Dynamic Select — Internal operations and advanced features.
A Dynamic Select control is an optional feature 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 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.
Don'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:
Single Value
.Text
.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 (that is, static) HTML Select box meets the need. See Harness and Section forms — Adding a Select control.
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. Specify the following in the list view rule:
The 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.
Often, 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:
InsNameStartsWith
parameter to the desired prefix text.Note: With Pega 7.1.7 local data storage replaces data tables.
Use this procedure when the values that users select and the values for the property are both present as columns in a report definition.
Find or create a report definition. Specify the following in the report definition:
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 runtime 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 runtime?
In some cases, your application can't present the needed data using only a list view, report definition, or clipboard page. 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:
Page List
.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.
Click the down-arrow () at the right end of the Advanced control group () and 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 magnifying glass ()to display the Cell Properties panel.
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(), the wireframe on the rule form changes immediately to reflect your inputs. If the panel is not pinned(), 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() 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 () to enter parameters.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 magnifying glass icon () to open the Client Event Editor in a new dialog window. Complete the Client Event Editor to select an event ( 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 |
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.
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.
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 magnifying class button () 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¶m=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 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 pyActivity=ActivityClass.ActivityName |
Set Primary Page |
Select |
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 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. 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:
|
OnDemandCaption |
Optional. Enter an optional string to appear as the caption of the default value when this Dynamic Select control is set to
To call an activity, use the following syntax, using URL percent encoding for special characters: pyActivity=myClass.myActivity¶m=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 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. |
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.
See the PDN articles: