Kbase P113902: Double tilde character '~~' replaces the fillchar in a FORMAT statement with a single tilde '~'.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/03/2006 |
|
Status: Unverified
SYMPTOM(s):
Double tilde character '~~' replaces the fillchar in a FORMAT statement with a single tilde '~'.
A format of "~~x999" when applied to a fillin field with a value of "888" should result in a display of "x888". But it results in "~ 888".
Fill characters are not displayed in a format specification of a fillin field.
The format mask to be applied to the fillin field is stored in the database with multiple leading tilde characters, e.g. "~~x999". When this is retrieved from the database and then applied to the fillin FORMAT attribute, the fill character 'x' is replaced by '~'.
When the same format is stored in a variable or applied directly to the fillin FORMAT attribute, then the fillchar is interpreted correctly.
CAUSE:
The database fillin mask has been entered manually into the database field with the keyboard. This has prevented Progress to evaluate the multiple tilde characters (and their actual meaning) when they are written to the database. Subsequently Progress thinks they are simply a literal string and not a character sequence indicating a FORMAT fill character.
FIX:
If this is a database field value then it is unnecessary to specify "~~". For example, run the following code:
DEFINE VARIABLE c2 AS CHARACTER INITIAL "888" NO-UNDO.
DEFINE VARIABLE c3 AS CHARACTER INITIAL "~~x999" NO-UNDO.
DEFINE FRAME f1 c2 FORMAT "X(10)" LABEL "VARIABLE".
FIND FIRST customer WHERE custnum = 2.
customer.comments = "~~x999".
c2:FORMAT = customer.comments. /* "~~x999" */
/* c2:FORMAT = c3. */
DISPLAY c2 customer.comments FORMAT "X(10)" WITH FRAME f1.
The assignment of the database field allows Progress to interpret the format "~~x999" to "~x999" when writing it to the database field. Subsequently when you assign it to the format specification Progress interprets the character after the tilde literally as "x", and the value is correct.