Kbase P34710: The LENGTH of a user input string is returned as ? when the
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/6/2003 |
|
Status: Unverified
SYMPTOM(s):
The LENGTH of a user input string is returned as ? when the input is the question mark '?'.
Executing code similar to:
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
UPDATE c.
MESSAGE c LENGTH(c) VIEW-AS ALERT-BOX.
CAUSE:
This is an expected behavior. When the user inputs the question mark alone, Progress interprets that as an UNKNOWN string. Since the LENGTH of an UNKNOWN string is UNKNOWN, the LENGTH function returns the Progress UNKNOWN value symbol ?.
FIX:
To access the ? as a string when the user input is made of the question mark only, the code needs to trap for that case and assign the SCREEN-VALUE of the fill-in to the variable:
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
UPDATE c.
IF c = ? THEN c = c:SCREEN-VALUE.
MESSAGE c LENGTH(c) VIEW-AS ALERT-BOX.