Formatting Text Objects, Data Fields and Variables
Previous Topic  Next Topic 

Each text object, including data fields and calculated variables, has an optional display format.  The display format for the object can be found in the Properties of the object on the left side of the DMS Report Designer.  In the example below, the Variable Job: Total Remaining Hours is selected.  By clicking on the  icon next to the DisplayFormat (circled in red in the example below) in the Properties window, the Display format window appears enabling you to format the object:



The Display Format window has the following prompts:


  1. Expression  Displays the object that the format will be applied to (i.e. the data field, variable name, etc.).
  2. Category  The Category allows you to select between Text (no formatting), Number, Date/Time, or Boolean.  Each of these categories options are described below.
  3. Format String  You can manually adjust the format string for a field by entering a valid string format command.
  4. Decimal Separator  The default decimal separator is a . but you can change it to something else as required.



Number


The Number category has 4 example formats you can choose from, or you can enter your own string format.  The 4 example formats are:

  1. 1234.5
  2. 1234.50
  3. $1234.50
  4. $1,234.50


The format string corresponding to the selected example format is shown in the Format string prompt.  Format strings contain two types of objects; literal characters and format specifiers. Literal characters are copied word for word to the resulting string. Format specifiers fetch arguments from the argument list and apply the formatting to them. 

Format specifiers have the following form: 

       "%" [width] ["." prec] type 

A format specifier begins with a % character. After the percent sign comes the following elements, in this order: 

  1. An optional width specifier, [width]. 
  2. An optional precision specifier, ["." prec]. 
  3. The conversion type character (single letter). 


The format string conversion type letter can be defined as follows: 


d         Decimal (integer)

e         Scientific

f         Fixed

g         General

m         Money

n         Number (floating)


To specify the literal percent sign % in the format string, you would use %%.  


Examples of Number


  1. %2.3f        A fixed point number with 3 digits after the decimal point as in 13.320, 20.000, 2.500, etc.
  2. %d%%         A whole number with a percent sign as in 98%, 100%, 2%, etc.
  3. %2.4n          A fraction with 4 digits after the decimal point as in 138.1234, 9.1000, etc.
  4. %2.4e          Scientific notation such as 1.332E+001, 2.000E+001, etc.
  5. %2.2m        A money value with 2 digits after the decimal point as in $2,513.32, $20.00, $2.50, etc.



Date/Time


The Date/Time category has seven date format examples you can choose from, or you can enter your own string format.  The seven format are:


  1. 11.28.2002 which is a format string of mm.dd.yy
  2. 28 nov 2002 which is a format string of dd mmm yyyy
  3. November 28, 2002 which is a format string of mmmm dd, yyyy
  4. 02:14 which is a format string of  hh:mm
  5. 02:14am which is a format string of hh:mm am/pm
  6. 02:14:00 which is a format string of hh:mm:ss
  7. 02:14am, November 28, 2002 which is a format string of hh:mm am/pm, mmmm dd, yyyy


The format string has several options that can be specified to build your own date format.  These are:


y                  Year last 2 digits

yy                  Year last 2 digits

yyyy         Year as 4 digits

m                  Month number no-leading 0

mm         Month number as 2 digits

mmm         Month using ShortDayNames (Jan)

mmmm          Month using LongDayNames (January)

d                  Day number no-leading 0

dd                  Day number as 2 digits

ddd         Day using ShortDayNames (Sun)

dddd         Day using LongDayNames  (Sunday)

ddddd         Day in ShortDateFormat

dddddd         Day in LongDateFormat

c                  Use ShortDateFormat + LongTimeFormat

h                  Hour number no-leading 0

hh                  Hour number as 2 digits

n                   Minute number no-leading 0

nn                  Minute number as 2 digits

s                  Second number no-leading 0

ss                  Second number as 2 digits

z                 Milli-sec number no-leading 0s

zzz         Milli-sec number as 3 digits

t                  Use ShortTimeFormat

tt                  Use LongTimeFormat

am/pm          Use after h : gives 12 hours + am/pm

a/p         Use after h : gives 12 hours + a/p

ampm         As a/p but TimeAMString,TimePMString

/                  Substituted by DateSeparator value

:                 Substituted by TimeSeparator value



Boolean


The Boolean category has four Boolean format examples you can choose from, or you can enter your own string format.  The four format are:


  1. 0,1                  Either 0 for false or 1 for true will be displayed
  2. No,Yes           Either No for false or Yes for true will be displayed
  3. _,x                  Either _ for false or x for true will be displayed
  4. False,True          Either False or True will be displayed


You can enter your own values for a Boolean format where the first value before the coma is for false and the value after the coma is for true.