You are on page 1of 5

9/2/2018 PICTURE function / template | Viva Clipper !

Viva Clipper !

Notes of a Clipper Language Student

PICTURE function / template

Posted on September 12, 2012 by vivaclipper

What is PICTURE function – template ?

@…SAY comand display data at a specified screen or printer row and column with
syntax :

@ <nRow>, <nCol> SAY <exp> [PICTURE <cSayPicture>] [COLOR <cColorSt

@…SAY command output can be forma ed using the PICTURE clause with a
<cSayPicture>. This performs the same action as the TRANSFORM() function. A
<cSayPicture> may consist of a function and/or a template. A PICTURE function
imposes a rule on the entire @…SAY output. A PICTURE template defines the length of
the @…SAY output and the forma ing rule for each position within the output.

Function string:

A PICTURE function string specifies forma ing rules which apply to the SAY’s entire
display value, rather than to particular character positions within it.

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/ 1/5
9/2/2018 PICTURE function / template | Viva Clipper !

The function string consists of the @ character, followed by one or more additional
characters, each of which has a particular meaning (see table below).

The function string must not 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.

SAY and TRANSFORM() PICTURE Format Functions


-------------------------------------------------------------------
Function Action
-------------------------------------------------------------------
B Displays numbers left-justified
C Displays CR after positive numbers
D Displays dates in SET DATE format
E Displays dates and numbers in British format
R Nontemplate characters are inserted
X Displays DB after negative numbers
Z Displays zeros as blanks
( Encloses negative numbers in parentheses
! Converts alphabetic characters to uppercase
-------------------------------------------------------------------

Template string:

A PICTURE template string specifies forma ing rules on a character-by-character


basis. The template string consists of a series of characters, some of which have special
meanings (see table below). Each position in the template string corresponds to a
position in the displayed SAY value. Characters in the template string that do not have
assigned meanings are copied verbatim into the displayed SAY value. If you use the @R
picture function, characters without special PICTURE template string meaning are
inserted between characters of the display value; otherwise, they overwrite the
corresponding characters of the display value. You may specify a template string alone
or with a function string. If both are present, the function string must precede the
template string, and the two must be separated by a single space.

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/ 2/5
9/2/2018 PICTURE function / template | Viva Clipper !

SAY and TRANSFORM() Template Symbols


-------------------------------------------------------------------
Template Action
-------------------------------------------------------------------
A,N,X,9,# Displays digits for any data type
L Displays logicals as "T" or "F"
Y Displays logicals as "Y" or "N"
! Converts alphabetic characters to uppercase
$ Displays a dollar sign in place of a leading space in a number
* Displays an asterisk in place of a leading space in a number
. Specifies a decimal point position
, Specifies a comma position
-------------------------------------------------------------------

Examples :

This example uses an @…SAY with a PICTURE clause to display forma ed output:

nNetIncome = 7125.50
nNetLoss = -125.50
cPhone = "2134567890"
cName = "Kate Mystic"

@ 1, 1 SAY nNetIncome PICTURE "@E 9,999.99" // Result: 7.125,50

@ 2, 1 SAY nNetLoss PICTURE "@)" // Result: (125.50)

@ 3, 1 SAY cPhone PICTURE "@R (999)999-9999" // Result: (213)456-78

@ 4, 1 SAY cName PICTURE "@!" // Result: KATE MYSTIC

This example is a small label printing program that uses SET DEVICE to direct output
to the printer and SETPRC() to suppress automatic EJECTs:

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/ 3/5
9/2/2018 PICTURE function / template | Viva Clipper !

USE Salesman INDEX Salesman NEW


SET DEVICE TO PRINTER
DO WHILE !EOF() // Print all records
@ 2, 5 SAY RTRIM(FirstName) + ", " + LastName
@ 3, 5 SAY Street
@ 4, 5 SAY RTRIM(City) + ", " + State + " " + PostalCode
@ 6, 0 SAY SPACE(1) // Move to label bottom
SETPRC(0, 0) // Suppress page eject
SKIP // Next record
ENDDO
SET DEVICE TO SCREEN
CLOSE Salesman

Advertisements

Report this ad

Report this ad
https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/ 4/5
9/2/2018 PICTURE function / template | Viva Clipper !

This entry was posted in Uncategorized and tagged @...SAY, Device, EJECT,
FUNCTION, picture, SET DEVICE, string, TEMPLATE, template function, template
string, TRANSFORM(). Bookmark the permalink.

Create a free website or blog at WordPress.com.

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/ 5/5

You might also like