LABEL FORM

From Lianjapedia
Jump to: navigation, search

Purpose

Generate mailing labels from a specified label format definition

Syntax

LABEL FORM <.lbl filename> | (<expC>)

[<scope>]

[FOR <condition>]

[FRAME]

[SEPARATE]

[TO PRINT | TO TERMINAL | TO FILE <.txt filename> | (<expC>)]

[WHILE <condition>]

[WIDTH <expN>]

See Also

CLOSE, CLOSE DATABASE, CREATE FROM, CREATE LABEL, DROP TABLE, INSERT, OPEN DATABASE, USE

Description

The LABEL FORM command is used to generate and print mailing and other labels. It operates by reading the format/layout of the labels from the <.lbl filename>. If no file extension is specified in the form file name, ".lbl" is assumed. The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.

The .lbl file is created from a defined table structure populated with a label definition record. See the example below for the table structure.

Keyword Description
<scope> If no <scope> is specified, the default is ALL, unless the WHILE clause is used, in which case the <scope> will default to REST.
FOR <condition> If the FOR clause is specified, only those records which satisfy the <condition> are selected.
FRAME The FRAME keyword puts a box around each label.
SEPARATE The SEPARATE keyword causes each row of labels to be separated by a line.
TO <file> The display output will be sent to the specified file. The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename. If no file extension is specified, then ".txt" will be used.
TO PRINT The display output will be sent to the current output window or file.
TO TERMINAL The display output will be sent to the current output window or file.
WHILE <condition> The WHILE <condition> can be used to restrict the range of records which are scanned in a table, and should be used to optimize the execution of the command. If the WHILE <condition> is used, then the <scope> will default to REST.
WIDTH <expN> The WIDTH clause specifies the number of labels to print across the page. The numeric expression <expN> denotes the number of labels.

Example

close database
open database southwind
drop table _label_example if exists
create table _label_example (width int, height int, margin int, lines int, spaces int, across int, ;
                            remark char(60), line1 char(50), line2 char(50), line3 char(50), line4 char(50),;
                            line5 char(50), line6 char(50), line7 char(50), line8 char(50), line9 char(50),;
                            line10 char(50), line11 char(50), line12 char(50), line13 char(50), line14 char(50),;
                            line15 char(50), line16 char(50))
insert into _label_example (width, height, margin, lines, spaces, across, remark, line1, line2, line3, line4, line5, line6) ;
                           values(30, 6, 2, 1, 10, 4, "Example label format", "contactname", "companyname", "address", "city", "postalcode", "country")
close _label_example
create label example from _label_example
use customers
label form example to file output.txt
close database