XFA Specification
Chapter 24, Picture Clause Specification
Picture-Clause Building Blocks
902
How Picture Clauses Evolved
Java's text API includes a
DateFormat
class which has evolved along similar principles; its meta-symbol
specifications is more intuitive than its Unix predecessors. Java's designers extended these concepts to
format and parse numeric data, again, in a locale-sensitive matter.
Java has substantially influenced picture clauses. There's almost a one-to-one correspondence between
our date and time picture clauses and the Java
SimpleDateFormat
class pattern strings. The need to
better accommodate legacy applications accounts for some of the differences — picture clauses were
initially described as part of FormCalc's date and time functions — functions that were modeled from
another legacy script language.
Picture-Clause Building Blocks
Picture clauses are expressed using a combination of symbols and literals. The symbols are either
context-specific (apply only in certain contexts, such as dates or times) or global.
Context-Specific Picture-Clause Symbols
The following example illustrates the result of applying a picture clause to two sample data values; the
picture clause is designed to format the numeric data values into a result with two fractional digits,
suppressing leading zeros, and adding a grouping separator:
Picture clause
zz,zz9.99
Input value
2157.5
50.6
Formatted result
2,157.5
50.60
The next example illustrates the result of applying a picture clause to two data values. The picture clause is
designed to parse numeric values having up to seven significant digits, the three least significant digits
being mandatory, with two of them being fractional digits; six and seven digit numbers must include a
grouping separator.
Picture clause
zz,zz9.99
Input value
2,157.50
50.60
Parsed result
2157.5
50.60
Due to the varying types of data that can benefit from the application of picture clauses, it is useful to
divide the picture clause symbols into categories that correspond to a type of data. This permits us to
reuse individual picture clause symbols across categories. For instance, the date picture clause
D/M/YYYY
makes use of the symbol
M
to represent the month portion of a date; however, it is equally useful to permit
the symbol
M
to represent the minute portion of a time in the picture clause
H:M:S
.
Note:
Picture clause symbols are case-sensitive and must correspond exactly to this specification.
Global Picture-Clause Symbols
There are some symbols that are used in all categories of picture clauses. These global picture cause
symbols are described in the following table:
Home Index Bookmark Pages
Pages: Home Index All Pages