Beginning with V5.4, special controls accessed from the Harness, Section, or Flow Action form simplify adding a Dynamic Select control to a form.
This article presents two examples of the V5.4 approach:
- Where the values are produced by a list view rule.
- Where the values are produced by an activity
For configuration steps in releases before V5.4, See How to configure a Dynamic Select control (V4.2)
A Dynamic Select control is a variant of the HTML Select control that presents to a user who is completing a form a drop-down list of choices. Unlike the static <SELECT> control, the list of options that appear may change from use to use. When the list is produced by an activity, the list may be determined by user privileges, data in an external database, time of day, or other dynamic factors.
Not all list selections are best implemented by a Dynamic Select control. Consider alternatives such as the autocomplete control if the list has a many choices, the list-to-list control if multiple selections are allowed, or an embedded list view with select check boxes. See How to add an autocomplete field to a flow action form.
In the simplest case, the contents of the drop-down list are determined by a list view rule. In a more advanced case, the contents are determined by an activity. In both cases, the display structure is based on the XML representation of a clipboard page of class Code-Pega-List.
In this example, a class named Data-Stocks contains three properties for each of 500 U.S. stocks.
- Ticker —an alphabetic symbol such as A for Agilent Technologies
- pyLabel — Company name
- Sector — An industry group, assigned by Standard & Poors
Case 1: List View
Step 1: Create a list view rule that displays the value or values needed in the control. Remember that users may select based on a value of a property that is different than the property saved in the controlled field.
In this case, users are to select one of the Label values (such Abbott Labs), but only the Ticker value ABT is saved in the work object.
The simple list view rule creates a page named Contents of class Code-Pega-List. The embedded pages sorted by pyLabel, contain all three properties. (The Sector property is not needed in Case 1.)
Step 2.Open the harness, flow action rule that is to contain the Dynamic Select control. Identify the rule to be modified. In this case, the section rule StatusSample.
Step 3. Open the section to the Layout tab. Select the Dynamic Select control from the Advanced Group. Drag it to a cell in the section and drop it.
Step 4. Click the magnifying glass control to open the Cell Properties panel for the control. On the Field tab, identify the work object property that is to contain the result.
Step 5. On the Presentation tab, click the magnifying glass at the right of the Format field to enter parameters for the DynamicSelect HTML Property rule.
Step 6. On the Param window, identify the two key parts to the list view rule, the property to show (optional), and the property to save.
Step 7. Click Save to close the Param window. Click Apply then click OK to close the Cell Properties panel. Click the Save toolbar button to save the Section form.
Step 8. Refresh the harness rule so it reflects the updated section rule. Save the refreshed Harness form. Test.
Step 9. Examine the clipboard to confirm that the correct property value is added to the work object. The user selected Akamai Technologies Inc; the clipboard contains the ticker value AKAM.
Case 2: Activity
In this example, an activity builds the Code-Pega-List structure. Typically, the activity starts with a page created by a list view rule, Obj-Browse method, or RDB-List method, but modifies or deletes the embedded pages.
Create and test the activity before configuring the Dynamic Select control.
Step 1: Build and test the activity. The example four-step activity Data-Stocks.OnlyNASDAQandIT executes the list view rule used in Case 1 above, but then removes some of the pages using an Obj-Filter method. The third step of the activity uses the Show-Page method to convert the Code-Pega-List page into an XML format, as required by the Dynamic Select control. (The final step removes the Contents page, to release the clipboard memory it uses.)
Check the May Start? check box on the Security tab. Save the Activity form.
The second step of this activity references a when rule named Data- Stock.NASDAQandIT. This rule evaluates to true only for instances of the Stock class where:
- the Sector value is "Information Technology" and
- the Ticker is at least four characters long. (Four-character ticker symbols indicate stocks that trade on the NASDAQ system rather than on a stock exchange.) Of course, a more complex activity could filter based on facts from the work object or from the current operator.
Step 2. Add the Dynamic Select control as in Steps 2 to 5 of Case 1 above. Complete the Param window to identify the activity (and values for its parameters, if any).
Step 3 . Click Save to close the Param window. Click Apply then click OK to close the Cell Properties panel. Click the Save toolbar button to save the Section form.
Step 4 . Refresh the harness rule so it reflects the updated section rule. Save the refreshed Harness form. Test.
The drop-down list shows only those stocks in the Information Technology sector which have 4-character ticker symbols.
How to configure cascading dynamic select controls
Introduction to activities