This content has been archived and is no longer being maintained.

Table of Contents

Article

Sample solution: HTML table click

This sample solution shows how to interrogate an HTML table that contains buttons in the data cells and then use the Click event of a table button to retrieve data from a corresponding cell using Pega® Robotic Automation Studio versions 7.1 and 8.0. The solution also shows how to use the Query parameter of the data cell’s Text property to locate a particular cell value in the table.

Project items

  • Web application: Dashboard
  • Windows form: Windows form1
  • Automation: Get Cell Value

Automation details

Get Cell Value

This automation provides the logic to display a selected product ID based on the row under the Upgrade History column in which you click the View button. The automation also retrieves the value from the Support Plan Charge column when provided with a specific product ID.

This automation is triggered when you click a View button in the Upgrade History column of the OpenSpan Dashboard HTML table. The automation then returns the value of the Product ID cell from the row in which the View button was selected.

Next, if you click the Get Support Plan Amount button on the Windows form, the value from the Support Plan Amount column is returned for the corresponding product ID. The automation uses the Query parameter of the DataCell control’s Text property to find the Support Plan Amount that corresponds to the specified product ID. The query syntax is “dataCell_ProdID=@dataCell_ProdID” as displayed in the following image:

The query syntax “dataCell_ProdID=@dataCell_ProdID”

The resulting connection block is displayed in the following image:

The resulting connection block

Note that the at sign (@) prefix creates a parameter for the Query. The product ID from the Windows form text box is used for the Query parameter. The resulting text for the dataCell_SuppoprtPlanChange is output to a label on the Windows form.

After you have set the query, you can add an event that triggers if the item searched for by the query is not found. Highlight and right-click the dataCell_SupportPlanChange connection block, then select Handle KeyNotFoundException.

Handle KeyNotFoundException in the right-click menu

When you select this option, a new event output is added to the connection block as displayed in the following image:

A new event output in the connection block

You can then connect this event to another control to handle the situation where the query input is not found. In the sample solution, the event is connected to a MessageDialog that displays this text: Item not found.

Steps

  1. Set the StartPath property for the web adapter to: http://training.openspan.com/dashboard.html
  2. Start the Interrogator. On the Interrogation Form, select the Create Global Web Page option.
  3. On the Interrogation Form, select HTML Table Designer as the interrogation option.
    HTML Table Designer selected as the interrogation option
  4. Drag the bull’s-eye over the table to under the Upgrade Summary heading.
  5. Select the first of the two Table HTML tags.
  6. The table opens in the HTML Table Designer. Highlight and right-click the first row of cells, then select Define Match Cell(s).
  7. Select and right-click the second row of cells, then select Define Table Section.
  8. Select and right-click the row of cells in the TableSection1, then select Define Data Cell(s).
  9. Click Apply Changes. The rest of the cells in the table are matched as repeating data cells in TableSection1.
  10. Click File > Save.
  11. Select the first MatchCell that is listed in the Table Schema matchCell1. In the Properties grid, rename the control so it reflects the contents, which in this case is Product ID. In the provided sample solution, the cell was renamed: matchcell_ProdID.
  12. Repeat this process for the rest of the match cell controls.
  13. Select the first DataCell that is listed in the table section of the table schema and rename it to reflect its contents. In the provided sample solution, the cell was renamed: dataCell_ProdID.
  14. Repeat this process for the rest of the data cells in the table section.
  15. Apply the changes and save the schema, then exit the HTML Table Designer.
  16. Return to the Interrogation Form and change the setting to Default.
  17. Interrogate the first View button that is listed in the Upgrade History column.

This completes the interrogation process. Your Object Explorer should resemble the following image. Make sure that the View button is added under the tableSection1:

Example Object Explorer list

You can download completed solutions for each version in the following table:

Studio version Built by using this build Sample solution download
7.1 7.1.26 HTML Table Click Example 7.1
8.0 8.0.1037 HTML Table Click Example 8.0

Published July 14, 2017 — Updated October 30, 2017


100% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.