Screen Recognition Rule Syntax

A screen recognition rule programmatically identifies a unique host screen or set of screens. When you navigate to a new host screen at design time, a new screen recognition rule is automatically generated.

The screen recognition rule consists of a logical statement, whose job it is to identify a unique host screen during run time; the logical statement is composed of multiple sub rules, which are concatenated together by AND statements. The sub rules identify the structure of the host screen (the total number of fields, the location and attributes of a field, or the field's value). You can customize, delete, or add sub rules within a screen recognition rule.

Note
  • When customizing the screen recognition rules, you need to exercise care to determine which fields are data-dependent.

    For example, let's say you have a screen that displays the label "Name:" followed by an actual customer's name. The protected label "Name:" remains constant, regardless of which customer is displayed. While you could add "Name:" label, adding the actual customer's name to the screen recognition rule would be a poor choice.

  • Automatically generated screen recognition rules do not contain sub rules that evaluate host data.

Syntax

Rules use all of the features of most scripting search methods, including wildcards (*, ?) and mathematical operators (+, -, ==, <, >). Rule expressions can be composed of the following:

There are numerous ways to format sub rules. As with all Boolean equations, the statement is always valid when true.

Rule Functions

The following list of functions can be used in rules.

Function Description Result Type
ATTRIBAT(row, col) Returns the attribute bits associated with a specified screen location, such as foreground and background color defaults, blinking text, field size, strikethrough, and so on. The values of these attributes may vary depending on your host type. Integer
ENDCOL(searchStr, count) Returns the end column of the given string. The string can contain wildcards (*,?). Count specifies the number of times the string must be matched. Integer
ENDROW(searchStr, count) Returns the end row of the given string. The string can contain wildcards (*,?). Count specifies the number of times the string must be matched. Integer
HOSTFIELDCOUNT(arg) Returns the number of actual host fields on the screen. Valid arguments are ANY, PROTECTED, and UNPROTECTED, and the argument must be within single quotes.
Note
  • When the number of fields on the host screen changes, HOSTFIELDCOUNT should not be used.

  • The default was previously ((HOSTFIELDCOUNT('ANY') == 0) AND HostField1 like '* sometext *'). If you upgraded from an earlier version of Presentation Designer, you will also need to update the screen recognition rule for any unformatted, customized screens to ((HOSTFIELDCOUNT('ANY') == 1) AND HostField1 like '* sometext *'), and publish the relevant applications again.
Integer
IF(bool-expr, expr1, expr2) Returns expr1 if the bool-expr evaluates to true, else returns expr2. expr1 or expr2
like Comparison operator that compares the value of a host field reference to a string (for example, HostField17 like '*DIAL VTAM4*'). The string must be enclosed within single quotes. Wildcards can be used. When comparing the value of a host field reference to a string, the string must be enclosed within asterisks (*); when comparing the value of user-defined fields, the asterisks are unnecessary. Boolean TRUE or FALSE
STARTCOL(searchStr, count) Returns the start column of the given string. The string can contain wildcards (*,?). Count specifies the number of times the string must be matched. Integer
STARTROW(searchStr, count) Returns the start row of the given string. The string can contain wildcards (*,?). Count specifies the number of times the string must be matched. Integer
STRINGAT(startRow, startCol, len) Returns the text starting at specified location and spanning the length. String
TRIM(string) Returns string after removal of spaces in the beginning and the end. String

Examples:

(ATTRIBAT(1, 1) == '1172527907584')
(ENDCOL('and', 2)==37)
(ENDROW('and', 2)==18)
(Hostfield0 > Hostfield1) OR (Hostfield3 > Hostfield4)
(Hostfield0 LIKE ('*ENDOFDATA'))
(HostField17 LIKE ('*DIAL VTAM4*'))
(HOSTFIELDCOUNT('ANY')==18)
(HOSTFIELDCOUNT('PROTECTED')==9)
(IF((STRINGAT(21, 1, 3) == 'See'), (STRINGAT(21, 1, 8) == 'See Spot'), (STRINGAT(21, 5, 9) == 'Spot run.')))
(STARTCOL('and', 2)==35)
(STARTROW('and', 2)==18)
(STRINGAT(21, 2, 8)=='PASSWORD')
(STRINGAT(24, 59, 11)==' RUNNING ')
(TRIM(Hostfield3)==('*A*B*C*'))
(TRIM(STRINGAT(24, 59, 11))=='RUNNING')
Related Topics
Bullet Adjusting How Screens are Identified, Overview
Bullet Improving Application Performance, Overview
  Attachmate