Acceptable Environment Attribute Format String Options

One of the most common questions I get when covering the topic of environment attributes in a ProjectWise Administrator class is "is there a list of items that work for the Format String option?" The typical answer is "You can use C formats to format the value of the attribute". Unfortunately, most of the users in the classes I have been in are not "C" programmers. They just want a simple list they can work with.

The following is from The Model Server Teammate Environment Editor, circa 1999. It is simple documentation that is still valid today.

Formatting fields

When you specify the settings for an Edit field, you can apply a format mask which ensures that the field displays the data in a particular format. Acceptable formats are:


Format              Effect
Empty String    String passed as entered.
%[Flags]           Type Restricts data to the set type and applies justification (See below)
date                   Only accepts a date in international date format (yyyy-mm-dd) eg 1999-12-01 for 1 Jan 1999
date,day            Only accepts a date in international date format (yyyy-mm-dd) eg 1999-12-01 for 1 Jan 1999
date,sec            Only accepts a date and time in international date format (yyyy-mm-dd hh:mm:ss) eg 1999-12-01
                            12:00:00 for noon on 1 Jan 1999
UpperCase      Converts entered text to upper case.
LowerCase      Converts entered text to lower case.

Flags

Flags can be used to define the justification of the field. Strings are always left justified. Numbers are right justified by default, but their justification can be amended by an optional flag. Acceptable entries are:

Flag      Effect
None    Right Justification.
-             Left Justification.
0            Fills empty leading spaces with zeros. (only with right justification)


Width sets the number of characters which can be entered or displayed.

Type

Type defines the data type which can be entered in the field. Acceptable entries are:


Type     Data type
s            String (any alpha-numeric character)
d            Decimal number. (Whole signed numbers eg -10)
u            Unsigned decimal number. (Whole unsigned numbers eg 10)
f              Floating point number. (eg 10.3)

For example, a field with the format string ‘%0u' accepts only unsigned decimal numbers and fills the leading empty spaces with zeros. If the user enters 1234 in a field whose length is set to 10, the number 0000001234 displays in the field.

A field with the format string ‘%-d' allows the user to enter a signed number and applies left justification to the field.

A field with the format string ‘%-s' allows the user to enter any character and applies left justification to the field.

JP