WebSphere Lombardi Edition 7.2 > Modeling processes > Advanced modeling tasks > Build Coaches


Configure Coach controls

When building Coaches, you have several options for configuring the Coach controls that you add. Read the following topics to learn more:

To learn how to... See...
Demonstrate the type of data that the Coach will display at run time Populating a list with static data
Bind dynamic data to a Coach control Populating a list with dynamic data
Bind a complex data structure to a Table control in a Coach Binding a complex data structure to a Table control
Use the Execute SQL option to retrieve data directly from a data source Populating a Table control using a SQL query
Render the content in an HTML block using the runtime value of a variable Binding a variable to a Custom HTML component
Make input mandatory by configuring a Coach control Making an input control a required field
Create a control that is displayed only when a related control is set to a specific value Displaying a control based on the input value of another control
Display a control to only those users who are members of a particular participant group Displaying a control to a specific group
Use a custom script to override the default visibility rules Use a custom script to control visibility
Add validation scripts for button controls to ensure that end users provide all required input Use validation scripts for button controls
Add field formatting capability to Input Text and Output Text controls and align button controls Control field and other formatting in Coaches


Populating a list with static data

Typically, a Coach displays business data that resides in a variable, enabling Lombardi end users to view and interact with the data. In the initial design stages, you may need to populate a Coach with static (manual) data so that you can illustrate the type of data that the process will display at run time. The following example illustrates a Combo Box control that uses static data to populate a list of options.

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Drag a Combo Box control from the palette onto the design area.

  3. Click the Presentation option in the properties.

  4. Under Manual Data, click the Add button to create a row for each option that you want to add to the list. The value that you type in the Display Text column is the name of the option that is displayed to the end user at run time.

  5. As shown in the following example, click the Preview tab to see how the list will work when the service runs:


Populating a list with dynamic data

Before you can bind dynamic data to a Coach control, you need to create the appropriate variables for your process or service. See the following topics to learn more:

To learn how to... See...
Create variables for a process Add process variables to a BPD and Declaring and passing variables
How to map those process variables to Coach controls The following procedure and Build a Human service for an example
Map variables to a nested service and then bind those variables to Coach controls Build an Integration service for an example

You can also bind Ajax services to Coach controls to perform actions such as automatically populating drop-down lists and enabling type-ahead capability in input fields.

The following procedure illustrates a Combo Box control (single-selection list) that uses a preexisting process variable to populate a list of options:

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

    Open or create a service for which you have declared a variable that is a complex structure.

  2. Drag a Combo Box control from the palette onto the design area.

  3. While the Combo Box control is still selected, click the Presentation option in the properties.

  4. Under Manual Data, click the Add button to include static instructions at the top of the drop-down list. For this example, the static text is: -- Select Dept –

  5. Under Dynamic Data, for the Based On option, click the List Variable radio button.

  6. For the Dynamic Binding option, click the Select button to choose the preexisting variable from the library .

    For this example, the control must be bound to a complex structure that is a list.

  7. Click the Preview tab to see how the list will work when the service runs :


Binding a complex data structure to a Table control

If you have created a complex data structure and you want to bind it to a Table control in a Coach, you do not have to create the table and then bind each element of the table to the appropriate variable parameter. You can create the table and the bindings automatically by dragging the data structure to the Coach. Before you can perform this task, first create the data structure and declare it in the service where you want to build a Coach.

You can also use the Activity Wizard to automatically create Coach control bindings. See Build a Human service for an example.

The following procedure illustrates how to create a complex structure and then use it in a Coach:

  1. The complex data structure shown in the following image is a private variable in an HR process used to submit requests to open new positions:

    You can see this process and its variables in the Quick Start Tutorial process application. (For more information see the Quick Start Tutorial Guide or online help.)

  2. At one point in the process, a General Manager must approve a submitted request. The Coach displays the information submitted in the requisition to enable the General Manager to make a decision. The GM Approval service (in the Quick Start Tutorial process application) includes the requisition variable as both input and output .

    This enables the Coach to display the requisition parameters to the General Manager and then the service passes the values of the parameters in the requisition variable back to the BPD for processing by subsequent steps in the process.

  3. To display the values of the parameters in the requisition variable in a Coach, click the Coaches tab.

  4. Drag the input requisition variable from the palette to the design area.

  5. Right-click and select Delete for the parameters that should not be displayed as output text; select all remaining fields and change the Control Type to Output Text.

  6. Click the Section option in the properties and increase the number of columns to 2 so that the Coach Design tab resembles the following image:

  7. Click the Preview tab to see how the table will look when the service runs. When you run the tutorial BPD, the Coach displays the table with the appropriate data for the manager to act upon as shown in the following image:


Populating a Table control using a SQL query

Table controls include an Execute SQL option that enables you to retrieve data directly from a data source. The Execute SQL option enables you to populate a Table control dynamically, without having to initialize the variable first. The following procedure illustrates how to dynamically populate a Table control using a query.

Before using a SQL query to populate a Table control, be aware of the following:


  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Drag a Table control from the palette onto the design area.

  3. While the Table control is selected, click the Presentation option in the properties.

  4. Click the Execute SQL check box to enable it.

  5. In the Data Source text box, type the data source from where you want to retrieve the data. By default, the data source is "jdbc/TeamworksDB", which points to Lombardi databases.

    When you want to use a data source other than the jdbc/TeamworksDB data source, ensure that it is an XA data source. If you use a non-XA data source, or an emulated XA data source, you might receive an error about a database connection failure.

  6. In the SQL text box, type a SQL query to select the data that you want from the data source.

    The following example selects the ID, status, and employee type from a table named R2H_PositionType:

    The order of the entries is in the order which the table rows are returned. Use an ORDER BY clause in your SQL statement to override this behavior.


Binding a variable to a Custom HTML component

The Custom HTML component can be used in a Lombardi Coach to accomplish a variety of runtime data presentations. The following example shows you how to render the content in an HTML block using the runtime value of a variable.

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Drag a Custom HTML control from the palette onto the design area.

  3. While the Custom HTML control is selected, click the Presentation option in the properties.

  4. In the HTML text box, type the variable whose value will populate the HTML block at run time.

    In this example, tw.local.myHTMLBlock is declared in the Variables tab for the service and then used to set the label of the HTML block at run time. Type the following in the HTML text box:

    <p><#=tw.local.myHTMLBlock#><p>

  5. To render the content in the HTML block, you need to run the service. When you run the service, the variable is evaluated and its runtime value is then passed to the Coach.

    For a quick test, define a default value for the variable (in the Variables tab) :

  6. Run the service to view the Coach. The Coach displays the runtime content of the HTML :


Making an input control a required field

Typically, a business process requires certain input from its runtime participants. You can make input mandatory by configuring a Coach control as described in the following steps:

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Click the Coach control that you want to make a required input area.

  3. Click the Visibility option in the properties.

    By default, input controls are visible to and can be edited by everyone.

    The Visibility properties enable you to restrict what process participants see in the run-time Coach, and under what conditions they see it.

  4. Click the Override Parent Visibility check box to enable it. Doing so allows you to change the default Visibility properties.

  5. From the Default Visibility list, select the Required (full access) for everyone option as shown in the following image:

  6. (Optional) Clear the Override Parent Visibility check box to set the Visibility properties back to read-only mode.

  7. Run the service to test the runtime Coach:

    If you leave the required input text box empty and then click Next, the input text box is shown in a different color and you are not able to end the task successfully until you supply the required input.


Displaying a control based on the input value of another control

The following procedure illustrates how to create a control that is displayed only when a related control is set to a specific value. The Coach in this example is used by new employees to specify the benefits that they want. If the employee decides to participate in a 401K plan, the Coach displays an input field where the employee can indicate the percentage of his pay to contribute to the plan.

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Drag a Radio Buttons control from the palette onto the design area.

  3. In the properties for the control, type I want to contribute to a 401K in the Label text box.

  4. Click the Presentation option in the properties.

  5. Under Manual Data, click the Add button to create two Value-Display pairs, one for each radio button option :

  6. Drag a Text control from the palette onto the design area.

  7. In the properties for the control, type 401K Contribution % in the Label text box.

  8. Click the Visibility option in the properties.

  9. Click the Override Parent Visibility check box to enable it. Doing so allows you to change the default Visibility properties.

  10. From the Default Visibility drop-down list, select the Hidden (no access) for everyone option.

  11. Click the Depends on Control button. This creates a new override condition.

  12. Under Control Dependent Visibility, select the Required (full access) option from the Visibility drop-down list.

  13. From the Control list, specify the Coach control whose input value will determine if the selected control will be displayed to participants when the service runs. (In this example, the I want to contribute to a 401K Radio Buttons control).

  14. From the Operator list, select the == (equals) operator.

  15. In the Value text box, type "true" . (This is the value that you assigned to the Yes radio button option in step 5.)

  16. Save the Coach and then run the service to see how the Input control is hidden and then shown according to the visibility rules you have specified.


Displaying a control to a specific group

The following procedure describes how to display a Coach control to only those end users who are members of a particular participant group. See Create a participant group for more information.

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. Click the Coach control that you want to display to only those members of a particular group.

  3. Click the Visibility option in the properties.

  4. Click the Override Parent Visibility check box to enable it. Doing so allows you to change the default Visibility properties.

  5. From the Default Visibility drop-down list, select the Hidden (no access) for everyone option.

  6. Click the Depends on Group button. This creates a new override condition.

  7. Under Group Dependent Visibility, click the Select button to choose the group that you want.

  8. Under Group Dependent Visibility, select the visibility option that you want for this group from the Visibility drop-down list.

  9. Save the Coach and then run the service to see how the control is hidden and then shown according to the visibility rules you have specified.


Use a custom script to control visibility

When your visibility rules are more complex than depending on group membership or depending on the value of another control, you can use a custom script to override the default visibility rules. The following procedure illustrates how you can create private variables to use in a custom visibility script, and how the values of those variables determines visibility of the selected control.

  1. Open the service that contains the Coach that you want to work with.

  2. Click the Variables tab and add the private variables that you need for the custom script. For this example, add Boolean variables named visible, enabled, and required.

  3. Click the Coaches tab.

  4. Click the Coach control for which you want to add visibility control.

  5. Click the Visibility option in the properties.

  6. Click the Override Parent Visibility check box to enable it. Doing so allows you to change the default Visibility properties.

  7. From the Default Visibility drop-down list, select the Hidden (no access) for everyone option.

  8. Click the Custom Script button.

  9. Under Custom Visibility, type the Javascript rule that you want to use to control visibility.

    The following example uses a server-side JavaScript function, and so return statements are required. For custom visibility using server-side JavaScript, return one of the following values (must be in all caps):

    "NONE" Hidden
    "READ" Disabled
    "FULL" Editable
    "REQUIRED" Required

    The following script causes the runtime Lombardi engine to check to see if user input is required. If user input is not required, the control is editable but not required. If the value of tw.local.visible is false, the control is not displayed to the end user.

    The following image shows the Coach controls and where to enter the script:

  10. You can set default values for the variables added in step 2 and then run the service to test the script.


Use validation scripts for button controls

When building Coaches in Lombardi, you can add client-side validation scripts for button controls. Validation scripts ensure that end users provide all required input. If not, the script provides the appropriate feedback to prompt end users for the required information. The following procedure describes how to add a client-side validation script for a Coach control:

  1. Open the service that contains the Coach that you want to work with and then click the Coaches tab.

  2. In the design area, click to select the control for which you want to add a validation script.

  3. Click the Presentation option in the properties.

  4. If multiple buttons are included in the control, under Buttons, click the button that needs the validation script.

  5. In the text box under Validation Script, type the JavaScript to validate that the required controls have been set and contain values as expected. To do this, use the control ID of each required control.

    The following example is client-side JavaScript that uses the default controls included when you add a new Coach to a service. The following validation script checks to ensure that the check box is enabled (set to true). If not, the end user is prompted to check it before proceeding by clicking the OK button.

    The following image shows the Coach controls and where to enter the script:

  6. Save the Coach and then run the service to test the script. You should see the following results when you click the OK button before enabling the check box:

Parent topic: Build Coaches

+

Search Tips   |   Advanced Search