Overview: Modifying Screen Recognition Rules

Recognition rules are the unique expressions used by Task Builder to identify and match each step in a task with its corresponding location on a host screen. As you record a task, a recognition rule is generated for each step in that task using the first and last two host fields on the screen. Using those recognition rules, Task Builder can compare the recorded step location with a live host screen and verify that each recorded task step matches its correct host screen.

Each step must have a unique recognition rule, especially those steps that immediately follow a transient step. Transient steps are the screens that are sent by the host without being requested by the user via an AID key.

Using Expressions and Functions

Expressions are used to create rules and other constraints within your task. You use expressions to produce unique recognition rules, and last page and selection rules in order to define tables, as well as to define other properties of your task. Properties that are designated as rules must evaluate to true or false.

Task Builder provides a group of functions for you to use when creating expressions. There are both screen and field functions and are only available to those expressions and variables that access screen data.

See Defining Rules with Expressions and Using Functions to Create Expressions for more information.

Using Fields in your Recognition Rules

The default recognition rule generated during recording defines how to match text within four host fields (the first two and last two). Task Builder, before looking at the text contained in each field, verifies that each host field is located at the recorded position and has the same size.

Because of this, a host field that changes position and length at run-time can cause the recognition rule to fail. Be aware of these types of fields, and watch for text that is always left or right justified, with adjacent text that may cause the shape of the field to vary.

To handle a "changing" or variable field in your recognition rule, you can either define a user field and include it, (if the text within the field can move, then you should make the user field relative and define start and end column expressions), or change the default recognition rule options in the Recording Options dialog box to use the STRINGNEAR or STRINGATPOSITION functions. STRINGNEAR matches the text in each field that has a start position in the range determined by the value specified in the StringNear parameter text box. This function is commonly used for screens that contain fields with variable start positions or of variable lengths. STRINGATPOSITION, on the other hand, verifies that the field's starting position on the screen and the string match. The length of the field is not verified.

Host fields, user fields, and relative fields all work differently in recognition rules. Perhaps it helps to think of them as absolute, user-defined, and elastic, respectively.

Use this field
When
Host field You want to confirm both the size and location of the field and some attributes of that field (usually text).
User field You want to confirm an attribute on the screen in the area specified.
Relative field You want to perform the same function as a user field, but allow the size and location to change based on the provided expressions. When the start and end columns are defined by expressions, the field is elastic.

Troubleshooting Recognition Rules

Always take a close look at the recognition rules generated by Task Builder. Although it is generally safe to trust the generated recognition rules, be careful when using the following:

The Task Failure Information dialog box provides detailed information to help you diagnose both task step and recognition rule failures. This dialog box provides a tree view representation of the failed recognition rule. To display this dialog box, click More Info on either the Navigation Error or Unrecorded Screen message box.

Related Topics
Bullet Designing Tasks, Overview
Bullet Modifying Screen Recognition Rules
Bullet Defining Rules with Expressions
Bullet Using Functions to Create Expressions
Bullet Adding User Fields
Bullet Recognition Rules for VT Hosts
  Attachmate