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:
The code first defines a variable named test, then displays it three times using two different character formats:
- The DEFINE VARIABLE statement specifies a format of x(10). This means that subsequent screen I/O statements that do not specify a format will allow I/O of up to ten characters.
- The SET statement specifies a format of x(20), allowing the user to supply up to 20 characters.
- The first DISPLAY statement does not specify a format, so Progress uses the FORMAT specified in the DEFINE VARIABLE statement. This means that if the previous SET statement inputs more than 10 characters, this DISPLAY statement displays only the first 10.
- The second DISPLAY statement specifies a format of x(20), allowing the display of all the characters input by the SET statement.
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.
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 |