Skip to main content

Query-driven matching

When interrogating tables with Pega Robot Studio, use the query-driven matching feature, which provides a fast and efficient method of matching table data. Unlike other methods of matching controls in web applications, the query-driven matching feature does not attach to controls in the web application when the page loads. Instead, during the development of your automation, you create a query, or multiple queries to identify a row or cell. At runtime, the system executes the chosen query(ies) in your automation and then attaches to only those controls that satisfy the query.

For example, you develop an automation that searches for customer information in a table based on their last name. Rather than attaching to every row in the table and then using your automation to loop through the rows and find the appropriate entry, you use the query-driven matching option. First, you set up a query that searches the last name column for a string that matches an input parameter. Then, at runtime, the user enters “Smith” as the last name to be searched. The system executes the query and returns a collection of rows with the last name of “Smith.”

Using the query-driven matching feature requires that you set the UseKeysOrQuery property on the control to UseQuery and that you have at least one query expression defined for the control.

UseQuery

To use the query-driven matching feature, set the UseKeysOrQuery property on the table row container control to UseQuery. Once the property is set, it cannot be reversed without deleting the control and reinterrogating. Controls with a magnifying glass designate the control as using the UseQuery setting, as shown in the following figure.

The object hierarchy for a table that has UseQuery turned on with the magnifying glass icon highlighted.

To modify the query expression(s) for the control, right click on the control and select View Query to display the Query editor dialog box. Click the + icons in the image below to learn more about the Query editor dialog box.

For more information about configuring Query expressions, see Matching data in HTML tables with query-driven matching.

Working with matched rows

To execute the query, add the ExecuteQuery method to your automation. The results of the query can then be passed into a ListLoop component. The ListLoop component yields a single row at a time. Within each yielded row, you can access the properties of the child controls, which are the specific cells of the table.

For example, the interrogated table has columns account, address, and name. The demonstration automation in the figure below returns rows that match the input parameter given, then displays the matched names one at a time in a MessageBox component.

An automation using the ExecuteQuery method and passing the result to a ListLoop component.

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice