Format Masks

Format masks objects are assigned to date and numeric fields and are used to define how data returned for that field is displayed.  Date fields are required to have format masks.  

Format masks have the following rules:

Xephr expects dates returned from the datasource to be in the format defined in the datasource.  The format mask is then applied to the date returned from the datasource.

Creating New Format Masks

  1. In the Explorer Tree, select the Format Mask Information object.

  2. There are options in creating a report template at this point.

  1. The Creating Format Mask screen is displayed.

  2. In the Format Mask property, enter the format mask that you are creating, using the rules described in the Format Mask Structure section.

  3. In the Data Type property, select the data type to which this format mask will be applied.  Choices are:
    Numeric
    Date (Only)
    Date and Time

  4. Click on the Create button to create the format mask.

  5. Click on the [Save] button in the main toolbar to save the new format mask.  Format masks cannot be modified once they have been created.

Format Mask Structure

Date Format Masks

Symbol

Meaning

Presentation

Example

G

Era Designator

Text

AD

y

Year

Number

1996

M

Month in Year

Text & Number

July & 07

d

Day in Month

Number

10

h

Hour in AM/PM (1-12)

Number

12

H

Hour in Day (0-23)

Number

0

m

Minute in Hour

Number

30

s

Second in Minute

Number

55

S

Millisecond

Number

978

E

Day in Week

Text

Tuesday

D

Day in Year

Number

189

F

Day of Week in Month

Number

2 (2nd Wed in July)

w

Week in Year

Number

27

W

Week in Month

Number

2

a

AM/PM Marker

Text

PM

k

Hour in Day (1-24)

Number

24

K

Hour in AM/PM (0-11)

Number

0

x

Time Zone

Text

Pacific Standard Time

'

Escape for Text

Delimiter

 

"

Single Quote

Literal

'

 

The count of pattern letters determine the format.

For Text types, if there are four or more pattern letters, use the full form.  If there are less than four pattern letters, use the short or abbreviated form.  

For Number types, the minimum number of digits should be entered.  If a number is entered that is less than this number of digits, they will be padded with zeros to this amount.  For y (Year), if the count of 'y' is 2, the Year will be truncated to 2 digits.

For Text & Number types, if there are three or more pattern letters, use text.  If less than three pattern letters are entered, us the number.

Examples:

Format Pattern

Result

yyyy.MM.dd G 'at' hh:mm:ss z

1996.07.10 AD at 15:08:56 PDT

EEE, MMM d, ''yy

Wed, July 10, '96

h:mm a

12:08 PM

hh 'o''clock' a, zzzz

12 o'clock PM, Pacific Daylight Time

K:mm a, z

0:00 PM, PST

yyyyy.MMMMM.dd GGG hh:mm aaa

1996.July.10 AD 12:08 PM

 

Number Format Mask

Number format masks can contain a positive and negative mask, separated by a semi-colon.  Zeros and # represent digits that must be present.  Commas add thousand separators, while decimals show where the decimal goes. In the following example, negative values will be displayed surrounded by parentheses.

For example: #,##0.00;(#,##0.00).  #,##0.00 is the positive display.  (#,##0.00) is the negative display.

Percentage signs are handled slightly different than other punctuation marks in format masks.  Adding a percent sign in a format mask indicates that you want the value multiplied by 100 and shown as a percentage.  So, if the value in your field is .85 and the format mask ###.##% is applied to the field, the value will be displayed as 85%.

If you want the percent symbol displayed without the percentage formatting applied, then the percent sign needs to be escaped in the format mask using single quotes: ###.##'%'

Format Masks for Spreadsheets

Spreadsheets have a special set of format masks that are understood.  The following format masks are good examples, but they can be expanded some (such as to more decimal places).

Date format masks are the same as those described in the Date Format masks section.

Format Pattern

Result

General

Formats exactly as it is in the datasource.
10.99 is formatted as 10.99.  13 is formatted as 13.

0

Rounds to the nearest whole number.
10.99 is formatted as 11.  12.3 is formatted as 12.

0.00

Formats with two decimal points, rounds to the nearest hundredth.  
10.99 is formatted as 10.99.  12.309 is formatted as 12.31.  13 is formatted as 13.00

#,##0

Rounds to nearest whole number.  Formats thousands with a comma.
10.99 is formatted as 11.  7058.25 is formatted as 7,058. 9258.6 is formatted as 9,259.

#,##0.00

Formats with two decimal points, rounds to the nearest hundredth.  Formats thousands with a comma.
10.99 is formatted as 10.99.  7058.253 is formatted as 7,058.25.  9258.6 is formatted as 9,258.60.

($#,##0_);($#,##0)

Rounds to nearest whole number.  Formats thousands with a comma.  Negative numbers are placed in parentheses.  The dollar sign ($) is placed before the value.
10.99 is formatted as $11.  7058.25 is formatted as $7,058.  -9300.50 is formatted as ($9,301).

($#,##0_);[Red]($#,##0)

Rounds to nearest whole number.  Formats thousands with a comma.  Negative numbers are placed in parentheses and colored red.  The dollar sign ($) is placed before the value.
10.99 is formatted as $11.  7058.25 is formatted as $7,058.  -9300.50 is formatted as ($9,301).

($#,##0.00_);($#,##0.00)

Formats with two decimal points, rounds to the nearest hundredth.  Negative numbers are placed in parentheses.  The dollar sign ($) is placed before the value.
10.99 is formatted as $10.99.  7058.253 is formatted as $7,058.25.  -9300.5 is formatted as ($9,300.50).

($#,##0.00_);[Red]($#,##0.00)

Formats with two decimal points, rounds to the nearest hundredth.  Negative numbers are placed in parentheses and colored red.  The dollar sign ($) is placed before the value.
10.99 is formatted as $10.99.  7058.253 is formatted as $7,058.25.  -9300.5 is formatted as ($9,300.50).

0%

Converts the value to a percentage by multiplying it by 100.  Rounds the result to the nearest whole number and adds a percentage sign (%) to the end.
10.99 formats as 1099%. 0.253 formats as 25%.

0.00%

Converts the value to a percentage by multiplying it by 100.  Rounds the result to the nearest hundredth and adds a percentage sign (%) to the end.
10.99 formats as 1099.00%.  0.253 formats as 25.30%

0.00E+00

Formatted using scientific notation, with 2 digits in the exponent.  A plus sign signifies a positive exponent while a minus sign signifies a negative exponent.
527748.95 is formatted as 053E+04.  -9300.5 is formatted as -9,301E+00.  0.25697 formats as 2,570E-04

# ?/?

Converts value to a whole number and its fractional single digit remainder.
10.75 formats as 10 3/4. 90.22 formats as 90 2/9.

# ??/??

Converts value to a whole number and its fractional double digit remainder.
10.75 formats as 10 3/4.  90.22 formats as 90 19/20.

 

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.