Validation Patterns on Key Prompts
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 02 JUN 1991 | 2.1X | INTERMEDIATE | WINDOW, VALIDATION, PATTERNS, CONVERSIONS |
Advanced Revelation version 2.1 introduces a change to Window that may affect applications that have user-defined conversions or custom validation patterns on key fields.
Prior to version 2.1, if a key field has a validation pattern, Window inserts one or two new validation patterns at the top of the list.
Pattern | Purpose |
---|---|
"\"0N | Allows access to query mode and to quick index lookup. |
"=" | Allows the sequential counter, (if present) to be reset. |
Many developers requested a way to prevent users from using query mode or resetting the counter. To achieve that, the additional validation patterns have been moved from the top of the validation list to the bottom.
The result is that you now can evaluate all input and can intercept it as needed.
For windows with user-defined conversions or custom validation patterns, this change has a side effect. Depending on the nature of the conversion, entering query mode with "\" can be very slow because the custom code is executed before the query window appears.
This will not affect most user-defined conversions and custom validation patterns. However, if you are having trouble with the speed of the query window display, you should check your program. You may be able to insert special handling logic at the top of the conversion to account for query mode.
Examples
Figure 1 shows how to turn off query mode from within a custom validation program. If you try to enter query mode, an error message displays, but STATUS() is not set to 3. Rather, it remains 0. The idea is to "fool" Window into thinking that the validation check succeeded, so the system does not call any of the other patterns.
The WINDOW_COMMON% variable WC_WC% is set to @INT.CONST<REFRESH$>, so the screen clears after you acknowledge the error message.
Figure 2 demonstrates how to skip special validation processing if you want to enter Query mode.
Figure 1
SUBROUTINE VALIDATION $INSERT INCLUDE, WINDOW_COMMON% $INSERT INCLUDE, EDIT.KEYS DECLARE SUBROUTINE MSG /* Check for numeric input. This is the same as "0N" */ STATUS() = 0 ;* Assume success IF NUM(@ANS) ELSE /* Failed the check. Is this query mode? */ IF @ANS = "\" OR @ANS = "\\" THEN /* Trying for query mode. Query mode is not available. */ MSG("Query mode is not available.", "", "","") WC_WC% = @INT.CONST<REFRESH$> END ELSE MSG("Data must be numeric.", "", "", "") STATUS() = 3 ;* must set STATUS() after MSG END END RETURN
Figure 2
SUBROUTINE VALIDATION $INSERT INCLUDE, WINDOW_COMMON% DECLARE SUBROUTINE MSG STATUS() = 0 IF @ANS[1,1] = "\" ELSE IF NUM(@ANS) ELSE MSG("You must enter numeric data.", "", "", "") STATUS() = 3 END END