Matching behavior
In Pega Robot Studio, controls and targets are organized into trees. For example, the Windows Calculator can be represented with the following tree:

Matching proceeds downward from the top-most element in the tree until there are no
controls left to match. Consider the following control hierarchy in which the Calculator
form, Clear button, Equals button, and
text box have been interrogated.
Studio first evaluates whether the Calculator control matches the Calculator target (the Calculator window). If the Calculator control matches successfully, Studio proceeds to match the Clear control. Each child of the Calculator is evaluated to determine if it matches the Clear control. In this case, the fourth child, the Clear target, matches the Clear control.
In most cases, once Studio has successfully matched a control to a target, it proceeds to the next control in the hierarchy. However, some controls, known as cloneable controls, can match multiple targets, in which case Studio proceeds through the entire list of targets to find all possible matches. An example of a cloneable target is a Multiple-document Interface (MDI) window.
Once Studio has successfully matched the Clear control, it proceeds to the Equals control. To match the Equals control, it iterates through the list of children until it finds the = button target.
To optimize the matching process, Studio records a matching index when a control is initially created. The matching index is the zero-based position of the target in the list of children. Although this is not guaranteed to be the same every time an application is run, it usually matches.
Matching proceeds from the matching index and fans outward. In the Calculator example, the Clear control has a matching index of three, and begins matching at the fourth child in the list. If, for some reason the C button is not the fourth child in the list, Studio proceeds outward from the fourth item in the list, evaluating the fifth item, then the third item, the sixth item, then the second item. Matching concludes when all of the controls in the hierarchy have been matched.
Previous topic Controls, targets, and match rules Next topic Understanding the control life cycle