Progress
Programming
Handbook


Using the FORMAT Option

You can use the FORMAT option in two ways:

The following example introduces some of the formatting syntax explained in the remaining sections. It also demonstrates the flexibility you have in defining multiple formats for a single widget:

p-ftchp2.p
DEFINE VARIABLE test AS CHARACTER FORMAT "x(10)" VIEW-AS FILL-IN.

REPEAT:
  SET test FORMAT "x(20)".
  DISPLAY test WITH FRAME aaa.
  DISPLAY test FORMAT "X(20)" WITH FRAME bbb.
END. 

The code first defines a variable named test, then displays it three times using two different character formats:

For example, if the user supplies 15 characters when the SET statement executes, the first DISPLAY statement makes it appear as if only 10 of those are stored, but the second DISPLAY statement shows that Progress has stored all 15 characters.

From the preceding example, we can see that a format does not affect a value already in a variable or database field; a format can only constrain the type of data the user enters into a field. Once in the field, the data can be displayed in any format, regardless of the original format.

If neither the Progress procedure nor the database specifies a format, Progress uses a default format based on the data type of the variable or field. Table 17–1 shows these default formats.

Table 17–1: Default Display Formats 

Data Type

Data Format
Example
Stored Value
Displayed Value
CHARACTER
x(8)
Now is the time
Now is t
DATE
99/99/99
3/10/199
03/10/93
DECIMAL
–>>,>>9.99
12345
12,345.00
INTEGER
–>,>>>,>>9
–12345
–12,345
LOGICAL
yes/no
on
yes

The following sections explain the syntax to use when specifying a format for each of these data types.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095