Picture Codes

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Picture Codes

Previous pageReturn to chapter overviewNext page

 

A picture code is a special sequence of characters that instructs ReportPro how to format data.  ReportPro allows picture codes in several places where having control over the formatting of information is beneficial.  For example, field objects accept picture codes so that you can control the formatting of floating point numbers and currency values.

 

The picture code consists of two distinct parts, a function string and template string, either or both of which may be present in the picture code.

 

Function Strings

 

The function string specifies formatting that applies to the entire piece of information, rather than particular character positions within it.  The function string consists of the @ character followed by one or more additional characters, each of which has a particular meaning (see the table below).  The function string must be the first element of a picture code and cannot contain spaces.  A function string may be specified alone or with a template string.  If both are present, the function string must precede the template string, and the two must be separated by a single space.

 

Function

 Type

 Action

B

 N

 Displays numbers left-justified.

R

 C

 Non-template characters are inserted in the display but not saved in the field.

Z

 N

 Displays zero as blank.

!

 C

 Converts alphabetic character to uppercase.

 

 

Template String

 
A template string specifies formatting on a character by character basis.  The template string consists of a series of characters, some of which have special meanings (see the table below).  Each position in the template string corresponds to a position in the data being formatted.  Characters in the template string which do not have assigned meanings are copied verbatim into the data.  If you use the @R picture function, these characters are inserted between characters of the data; otherwise they overwrite the corresponding characters of the data.

 

Template

 Action

N

 Displays only alphabetic and numeric characters.

9

 Displays only digits (and sign character for numeric fields).

L

 Displays logicals as T or F.

Y

 Displays logicals as Y or N.

!

 Converts an alphabetic character to upper case.

$

 Displays a dollar sign in place of a leading space in a numeric.

.

 Displays a decimal point.

,

 Displays a comma.

 

 

Examples

 

The following are examples of values and the effect that picture codes have on the way they are formatted.

 

                         Value:                                                123654987

                         Format Picture:                                999,999,999

                         Displayed:                                123,654,987

 

                         Value:                                                John Smith

                         Format Picture:                                @!

                         Displayed:                                JOHN SMITH

 

                         Value:                                                009564311

                         Format Picture:                                @R  999-99-9999

                         Displayed:                                009-56-4311